-
Notifications
You must be signed in to change notification settings - Fork 667
TreeView: provide a way to control ability to select nodes #32433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 26_1
Are you sure you want to change the base?
Conversation
eb1002c to
768a583
Compare
666d3c5 to
02df753
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new TreeView option to control whether disabled nodes participate in checkbox selection logic, and introduces test coverage for the new selection behavior.
Changes:
- Added
disabledNodeSelectionModeoption to TreeView base and wired it into the hierarchical data adapter. - Updated selection propagation and “select all” state calculation to optionally skip disabled nodes.
- Added QUnit coverage for initial state, selectAll/unselectAll, runtime option changes, and recursive selection scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/devextreme/testing/tests/DevExpress.ui.widgets/treeView.checkboxes.tests.js | Adds tests validating selection/aria-checked behavior for the new mode. |
| packages/devextreme/js/__internal/ui/tree_view/tree_view.base.ts | Adds the new option, default value, option change handling, and passes it to the data adapter. |
| packages/devextreme/js/__internal/ui/hierarchical_collection/data_converter.ts | Tracks disabled items count to support “select all” state computation. |
| packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts | Implements skip-disabled selection logic in recursive selection and selectAll/isAllSelected. |
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_converter.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Outdated
Show resolved
Hide resolved
3f646fa to
3f2314a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
packages/devextreme/testing/tests/DevExpress.ui.widgets/treeView.checkboxes.tests.js
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/ui/hierarchical_collection/data_adapter.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| if (this.options.disabledNodeSelectionMode === 'never' && this._isNodeDisabled(node)) { | ||
| return; | ||
| } | ||
|
|
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an inconsistency between selectAll() behavior and recursive selectItem() behavior when disabledNodeSelectionMode='never'.
When selectAll() is called, it iterates through all nodes (line 570) and selects all enabled nodes, including children of disabled nodes (as shown in test at line 594 in treeView.checkboxes.tests.js).
However, when selectItem(parentKey) is called with recursiveSelection=true, the _iterateChildren method has an early return (lines 251-253) that prevents iterating into children of disabled nodes. This means children of disabled nodes won't be selected when selecting their grandparent.
This inconsistency is demonstrated in the tests:
- Test at line 594:
selectAll()with mode='never' DOES select children of disabled nodes - Test at line 633:
selectItem(parentId)with mode='never' does NOT select children of disabled nodes
Consider removing the early return at lines 251-253 to make the behavior consistent, or add clear documentation explaining why these two operations behave differently.
| if (this.options.disabledNodeSelectionMode === 'never' && this._isNodeDisabled(node)) { | |
| return; | |
| } |
No description provided.