AI Assistant: Add possibility to select/deselect rows on any page depending on scope#33865
Open
dmirgaev wants to merge 4 commits into
Open
AI Assistant: Add possibility to select/deselect rows on any page depending on scope#33865dmirgaev wants to merge 4 commits into
dmirgaev wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Grid AI Assistant’s selectByIndexes command so row selection/deselection can target either the current rendered page or the full filtered/sorted dataset, controlled by a new scope argument.
Changes:
- Added
scope: 'dataset' | 'page'to theselectByIndexespredefined command typings. - Implemented dataset-level index resolution by loading rows via the grid’s data store (with contiguous-range chunking).
- Added/updated Jest tests for the new range-splitting helper and for
selectByIndexesbehavior across both scopes.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/ts/dx.all.d.ts | Adds scope to the public selectByIndexes command args in the bundled TS declarations. |
| packages/devextreme/js/common/grids.d.ts | Adds scope to PredefinedCommands.selectByIndexes for public API typings. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/utils.ts | Introduces splitIntoContiguousRanges helper used to chunk dataset index loads. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/selection.ts | Implements scope handling and dataset/page key resolution for selectByIndexes. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/tests/utils.test.ts | Adds unit tests for splitIntoContiguousRanges. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/tests/selection.test.ts | Updates and expands tests for selectByIndexes with the new scope behavior. |
560eaee to
7622162
Compare
arman-boyakhchyan
approved these changes
Jun 5, 2026
anna-shakhova
requested changes
Jun 8, 2026
| let current: number[] = []; | ||
|
|
||
| sorted.forEach((value) => { | ||
| if (current.length === 0 || value === current[current.length - 1] + 1) { |
Contributor
There was a problem hiding this comment.
Suggested change
| if (current.length === 0 || value === current[current.length - 1] + 1) { | |
| if (current.length === 0 || value === current.at(-1) + 1) { |
| let current: number[] = []; | ||
|
|
||
| sorted.forEach((value) => { | ||
| if (current.length === 0 || value === current[current.length - 1] + 1) { |
Contributor
There was a problem hiding this comment.
if user asks to select every second line, then we generate n/2 ranges with length 2 and make that much load requests. Perhaps, it is worth make ranges not smaller then page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.