fix: 修复crud2自定义显示列不生效问题

This commit is contained in:
zhangtao07 2024-02-01 11:55:47 +08:00
parent 8039d312dc
commit 2d39ba9147
2 changed files with 6 additions and 4 deletions

View File

@ -1097,13 +1097,14 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
}
@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
}))
);
}

View File

@ -81,7 +81,8 @@ export class ColumnTogglerRenderer extends React.Component<ColumnTogglerRenderer
className={cx('ColumnToggler-menuItem')}
key={'selectAll'}
onClick={() => {
toggleAllColumns && toggleAllColumns();
toggleAllColumns &&
toggleAllColumns(activeToggaleColumns?.length <= 0);
}}
>
<Checkbox