diff --git a/frontend/src/pages/data-grid/app-main.js b/frontend/src/pages/data-grid/app-main.js index 0da1c999c4..18c02a54e4 100644 --- a/frontend/src/pages/data-grid/app-main.js +++ b/frontend/src/pages/data-grid/app-main.js @@ -123,11 +123,10 @@ class AppMain extends React.Component { this.props.onContentChanged(); } - handleGridRowsUpdated = ({ cellKey, fromRow, updated }) => { + handleGridRowsUpdated = ({fromRow, updated}) => { let rowIdx = fromRow; - let value = this.dTableStore.modifyCell(rowIdx, cellKey, updated[cellKey]); + let value = this.dTableStore.modifyCell(rowIdx, updated); this.setState({value}); - this.forceUpdate(); this.props.onContentChanged(); } diff --git a/frontend/src/pages/data-grid/store/apply.js b/frontend/src/pages/data-grid/store/apply.js index 0cc28d1075..6393ef35e9 100644 --- a/frontend/src/pages/data-grid/store/apply.js +++ b/frontend/src/pages/data-grid/store/apply.js @@ -35,8 +35,10 @@ function apply(value, op) { } case OperationTypes.MODIFY_CELL : { - let { rowIdx, key, newValue } = op; - next[rowIdx][key] = newValue; + let { rowIdx, updated } = op; + let updateRow = next[rowIdx]; + updateRow = Object.assign({}, {...updateRow}, updated); // todo + next[rowIdx] = updateRow; return next; } diff --git a/frontend/src/pages/data-grid/store/dtable-store.js b/frontend/src/pages/data-grid/store/dtable-store.js index e7634b6894..a57414ad76 100644 --- a/frontend/src/pages/data-grid/store/dtable-store.js +++ b/frontend/src/pages/data-grid/store/dtable-store.js @@ -108,9 +108,10 @@ export default class DTableStore { return this.value; } - modifyCell(rowIdx, key, newValue) { + modifyCell(rowIdx, updated) { let type = OperationTypes.MODIFY_CELL; - let operation = this.createOperation({type, rowIdx, key, newValue}); + let operation = this.createOperation({type, rowIdx, updated}); + let next = operation.apply(this.value.rows); this.operations.push(operation);