fix: change vCell value after changed.

This commit is contained in:
Chen Lily 2024-03-05 08:43:07 +08:00
parent 4096979d5d
commit 6de4987360

View File

@ -477,7 +477,7 @@ const GridColumnDirection = {
/** /**
* @typedef GridVirtualRow * @typedef GridVirtualRow
* @property {boolean} editing - 行处于编辑状态 * @property {boolean} editing - 行处于编辑状态
* @property {IndexMap<GridVirtualCell>} cells - 虚拟单元格数组 * @property {KeyMap<GridVirtualCell>} cells - 虚拟单元格数组
* @private * @private
*/ */
@ -2439,7 +2439,7 @@ export class Grid {
} }
cols.forEach((col, j) => { cols.forEach((col, j) => {
const cell = createElement('td', 'ui-grid-cell'); const cell = createElement('td', 'ui-grid-cell');
virtualRow.cells[j] = {}; virtualRow.cells[col.key ?? j] = {};
if (col.visible !== false) { if (col.visible !== false) {
let style = this._get(col.key, 'style') ?? {}; let style = this._get(col.key, 'style') ?? {};
if (col.isfixed) { if (col.isfixed) {
@ -2590,7 +2590,7 @@ export class Grid {
if (cell == null) { if (cell == null) {
return; return;
} }
const virtualCell = virtualRow.cells[j]; const virtualCell = virtualRow.cells[col.key ?? j];
let val; let val;
if (col.text != null) { if (col.text != null) {
val = col.text; val = col.text;
@ -3874,6 +3874,10 @@ export class Grid {
oldValue ??= val; oldValue ??= val;
item[col.key] = value; item[col.key] = value;
} }
const virtualCell = this._var.virtualRows[index]?.cells[col.key];
if (virtualCell != null) {
virtualCell.value = value;
}
let tip = col.tooltip; let tip = col.tooltip;
if (typeof tip === 'function') { if (typeof tip === 'function') {
tip = tip.call(col, item); tip = tip.call(col, item);