From 6de498736091288fc31cbb31f5ca670a314d939c Mon Sep 17 00:00:00 2001 From: Tsanie Date: Tue, 5 Mar 2024 08:43:07 +0800 Subject: [PATCH] fix: change vCell value after changed. --- lib/ui/grid/grid.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ui/grid/grid.js b/lib/ui/grid/grid.js index fb4f3ff..2533250 100644 --- a/lib/ui/grid/grid.js +++ b/lib/ui/grid/grid.js @@ -477,7 +477,7 @@ const GridColumnDirection = { /** * @typedef GridVirtualRow * @property {boolean} editing - 行处于编辑状态 - * @property {IndexMap} cells - 虚拟单元格数组 + * @property {KeyMap} cells - 虚拟单元格数组 * @private */ @@ -2439,7 +2439,7 @@ export class Grid { } cols.forEach((col, j) => { const cell = createElement('td', 'ui-grid-cell'); - virtualRow.cells[j] = {}; + virtualRow.cells[col.key ?? j] = {}; if (col.visible !== false) { let style = this._get(col.key, 'style') ?? {}; if (col.isfixed) { @@ -2590,7 +2590,7 @@ export class Grid { if (cell == null) { return; } - const virtualCell = virtualRow.cells[j]; + const virtualCell = virtualRow.cells[col.key ?? j]; let val; if (col.text != null) { val = col.text; @@ -3874,6 +3874,10 @@ export class Grid { oldValue ??= val; item[col.key] = value; } + const virtualCell = this._var.virtualRows[index]?.cells[col.key]; + if (virtualCell != null) { + virtualCell.value = value; + } let tip = col.tooltip; if (typeof tip === 'function') { tip = tip.call(col, item);