From baec3a395970ab842bc2da5057f35ac8f8c615bf Mon Sep 17 00:00:00 2001 From: Tsanie Date: Tue, 5 Mar 2024 14:17:16 +0800 Subject: [PATCH] clean code --- lib/ui/grid/grid.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/ui/grid/grid.js b/lib/ui/grid/grid.js index 2533250..23774e6 100644 --- a/lib/ui/grid/grid.js +++ b/lib/ui/grid/grid.js @@ -1539,14 +1539,13 @@ export class Grid { /** * 重新填充Grid单元格数据 - * @param {boolean} [force] - 忽略 `value` 的判断进行强制刷新 */ - refresh(force) { + refresh() { if (this._var.refs.body == null) { throw new Error('body has not been created.'); } const widths = {}; - this._fillRows(this._tableRows, this.columns, widths, force); + this._fillRows(this._tableRows, this.columns, widths); if (this._var.needResize && widths.flag) { this._var.needResize = false; this.columns.forEach((col, i) => { @@ -2507,10 +2506,9 @@ export class Grid { * @private * @param {HTMLTableRowElement[]} rows * @param {GridColumnDefinition[]} cols - * @param {any} widths - * @param {boolean} [force] + * @param {any} [widths] */ - _fillRows(rows, cols, widths, force) { + _fillRows(rows, cols, widths) { const startIndex = this._var.startIndex; const selectedIndexes = this._var.selectedIndexes; const offset = this.expandable ? 1 : 0; @@ -2673,7 +2671,7 @@ export class Grid { type.setEditing(element, virtualRow.editing); } } - if (force || val !== virtualCell.value) { + if (val !== virtualCell.value) { virtualCell.value = val; type.setValue(element, val, vals, col, this); } @@ -2789,6 +2787,7 @@ export class Grid { * @private * @param {number} index * @param {number} width + * @param {boolean} [freeze] */ _changeColumnWidth(index, width, freeze) { const col = this.columns[index];