diff --git a/packages/amis/src/renderers/CRUD2.tsx b/packages/amis/src/renderers/CRUD2.tsx index 44221cda8..22a990520 100644 --- a/packages/amis/src/renderers/CRUD2.tsx +++ b/packages/amis/src/renderers/CRUD2.tsx @@ -1097,13 +1097,14 @@ export default class CRUD2 extends React.Component { } @autobind - toggleToggle(toggled: boolean, index: number) { + toggleToggle(index: number) { const {store} = this.props; - + const column = store.columns[index]; + const toggled = column.toggled; store.updateColumns( store.columns.map((c: any, i: number) => ({ ...c, - toggled: index === i ? toggled : c.toggled !== false + toggled: index === i ? !toggled : c.toggled !== false })) ); } diff --git a/packages/amis/src/renderers/Table2/ColumnToggler.tsx b/packages/amis/src/renderers/Table2/ColumnToggler.tsx index 1ee68f589..1453e6b47 100644 --- a/packages/amis/src/renderers/Table2/ColumnToggler.tsx +++ b/packages/amis/src/renderers/Table2/ColumnToggler.tsx @@ -81,7 +81,8 @@ export class ColumnTogglerRenderer extends React.Component { - toggleAllColumns && toggleAllColumns(); + toggleAllColumns && + toggleAllColumns(activeToggaleColumns?.length <= 0); }} >