Skip to content

Commit c4816b4

Browse files
committed
fix: update option keep data
1 parent 88583d6 commit c4816b4

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

docs/assets/api/en/methods.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66

77
Update table configuration items, which will be automatically redrawn after being called.
88

9-
updateConfig parameter description:
10-
11-
- keepData: When the new option does not pass in records or dataSource, whether to retain the original data. The default is false
12-
139
```ts
1410
/**
1511
*Update options currently only support full updates
1612
* @param options
1713
*/
18-
updateOption(options: BaseTableConstructorOptions,updateConfig?:{
19-
//When the new option does not pass in records or dataSource, whether to retain the original data. The default is false
20-
keepData?:boolean
21-
}) => void
14+
updateOption(options: BaseTableConstructorOptions) => void
2215
```
2316

2417
If you need to update a single configuration item, please refer to the other `update**` interfaces below

docs/assets/api/zh/methods.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,12 @@
66

77
更新表格配置项,调用后会自动重绘。
88

9-
updateConfig 参数说明:
10-
11-
- keepData: 当新的option没有传入records或者dataSource时,是否保留原本的数据。默认为false
12-
139
```ts
1410
/**
1511
* 更新options 目前只支持全量更新
1612
* @param options
1713
*/
18-
updateOption(options: BaseTableConstructorOptions,updateConfig?:{
19-
//当新的option没有传入records或者dataSource时,是否保留原本的数据
20-
keepData?:boolean
21-
}) => void
14+
updateOption(options: BaseTableConstructorOptions) => void
2215
```
2316

2417
如果需要更新单个配置项,请参考下面其他`update**`接口

packages/vtable/src/ListTable.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -478,15 +478,7 @@ export class ListTable extends BaseTable implements ListTableAPI {
478478
}
479479
return ifCan;
480480
}
481-
updateOption(
482-
options: ListTableConstructorOptions,
483-
updateConfig: {
484-
//当新的option没有传入records或者dataSource时,是否保留原本的数据
485-
keepData?: boolean;
486-
} = {
487-
keepData: false
488-
}
489-
) {
481+
updateOption(options: ListTableConstructorOptions) {
490482
const internalProps = this.internalProps;
491483
super.updateOption(options);
492484
internalProps.frozenColDragHeaderMode =
@@ -525,7 +517,7 @@ export class ListTable extends BaseTable implements ListTableAPI {
525517
if (internalProps.releaseList) {
526518
for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
527519
const releaseObj = internalProps.releaseList[i];
528-
if (updateConfig.keepData && releaseObj instanceof DataSource) {
520+
if (releaseObj instanceof DataSource) {
529521
releaseObj.updateColumns(this.internalProps.columns);
530522
} else {
531523
releaseObj?.release?.();

0 commit comments

Comments
 (0)