Skip to content

Commit

Permalink
fix(amis): table嵌套在crud下面,setValue时通过crud进行操作,解决crud的setValue动作失效的问题
Browse files Browse the repository at this point in the history
Closes #11453
  • Loading branch information
ranwawa committed Jan 8, 2025
1 parent 7921c21 commit c0d41bb
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/amis/src/renderers/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3047,7 +3047,7 @@ export class TableRendererBase extends Table {
index?: number | string,
condition?: any
) {
const {store} = this.props;
const {store, host} = this.props;

if (index !== undefined || condition !== undefined) {
const targets = await this.getEventTargets(
Expand All @@ -3058,13 +3058,19 @@ export class TableRendererBase extends Table {
targets.forEach(target => {
target.updateData(values);
});
} else {
const data = {
...values,
rows: values.rows ?? values.items // 做个兼容
};
return store.updateData(data, undefined, replace);
return;
}

if (host) {
host.setData?.(values, replace);
}

const data = {
...values,
rows: values.rows ?? values.items // 做个兼容
};

return store.updateData(data, undefined, replace);
}

getData() {
Expand Down

0 comments on commit c0d41bb

Please sign in to comment.