Skip to content

Commit

Permalink
Merge pull request #1911 from epam/fix/picker-input-clear-all-cascade…
Browse files Browse the repository at this point in the history
…-selection

[LazyListView]: Removed loading data on uncheck all.
  • Loading branch information
AlekseyManetov authored Jan 8, 2024
2 parents d705f5d + 336ff84 commit 5c4b5ae
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion uui-core/src/data/processing/views/LazyListView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,22 @@ export class LazyListView<TItem, TId, TFilter = any> extends BaseListView<TItem,
};

protected handleSelectAll = (value: boolean) => {
this.checkItems(value, true);
if (value) {
this.checkItems(value, true);
} else {
// if cascadeSelection mode (implicit or explicit) is enabled, mostly all the rows
// should be loaded. It is very expensive and slow.
// To avoid it, only those items, which are selectable, should be unchecked, avoiding cascading logic.
const checked = this.fullTree.cascadeSelection(this.value.checked, undefined, value, {
cascade: false,
isSelectable: (item: TItem) => {
const { isCheckable } = this.getRowProps(item, null);
return isCheckable;
},
});

this.handleCheckedChange(checked);
}
};

private async checkItems(isChecked: boolean, isRoot: boolean, checkedId?: TId) {
Expand Down

0 comments on commit 5c4b5ae

Please sign in to comment.