Skip to content

Commit

Permalink
feat: pivot table change cells value when real update
Browse files Browse the repository at this point in the history
  • Loading branch information
taiiiyang committed Dec 21, 2024
1 parent 47b705b commit 9611946
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions packages/vtable/examples/editor/date-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,8 @@ export function createTable() {
tableInstance.on('initialized', args => {
console.log('initialized');
});
tableInstance.on('change_cell_value', arg => {
console.log(arg);
});
window.tableInstance = tableInstance;
}
18 changes: 10 additions & 8 deletions packages/vtable/src/PivotTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1799,14 +1799,16 @@ export class PivotTable extends BaseTable implements PivotTableAPI {
newValue = parseFloat(value);
}
this._changeCellValueToDataSet(startCol + j, startRow + i, oldValue, newValue);

this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
col: startCol + j,
row: startRow + i,
rawValue,
currentValue: oldValue,
changedValue: this.getCellOriginValue(startCol + j, startRow + i)
});
const changedValue = this.getCellOriginValue(startCol + j, startRow + i);
if (changedValue !== oldValue) {
this.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
col: startCol + j,
row: startRow + i,
rawValue,
currentValue: oldValue,
changedValue
});
}
}
}
pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
Expand Down

0 comments on commit 9611946

Please sign in to comment.