Merge pull request #9575 from zhangtao07/master

fix: 修复crud2自定义显示列不生效问题
This commit is contained in:
张涛 2024-02-02 10:40:26 +08:00 committed by GitHub
commit d6208f8d05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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