表格添加一个setRows方法以便数据回显后重新获取数据 (#2327)

This commit is contained in:
zxiaozhou 2022-11-06 06:55:39 +08:00 committed by GitHub
parent 17d16ae545
commit eda251a426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -136,6 +136,7 @@
getRowSelection,
getRowSelectionRef,
getSelectRows,
setSelectedRows,
clearSelectedRowKeys,
getSelectRowKeys,
deleteSelectRowByKey,

View File

@ -76,6 +76,9 @@ export function useTable(tableProps?: Props): [
redoHeight: () => {
getTableInstance().redoHeight();
},
setSelectedRows: (rows: Recordable[]) => {
return toRaw(getTableInstance().setSelectedRows(rows));
},
setLoading: (loading: boolean) => {
getTableInstance().setLoading(loading);
},

View File

@ -84,6 +84,7 @@ export type SizeType = 'default' | 'middle' | 'small' | 'large';
export interface TableActionType {
reload: (opt?: FetchParams) => Promise<void>;
setSelectedRows: (rows: Recordable[]) => void;
getSelectRows: <T = Recordable>() => T[];
clearSelectedRowKeys: () => void;
expandAll: () => void;