Skip to content

AI Assistant: Add possibility to select/deselect rows on any page depending on scope#33865

Open
dmirgaev wants to merge 4 commits into
DevExpress:26_1from
dmirgaev:26_1__select_by_indexes
Open

AI Assistant: Add possibility to select/deselect rows on any page depending on scope#33865
dmirgaev wants to merge 4 commits into
DevExpress:26_1from
dmirgaev:26_1__select_by_indexes

Conversation

@dmirgaev

@dmirgaev dmirgaev commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 5, 2026 12:08
@dmirgaev dmirgaev requested a review from a team as a code owner June 5, 2026 12:08
@dmirgaev dmirgaev self-assigned this Jun 5, 2026
@github-actions github-actions Bot added the .d.ts label Jun 5, 2026
@dmirgaev dmirgaev requested a review from a team June 5, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the selectByIndexes predefined 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 selectByIndexes behavior 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.

@dmirgaev dmirgaev force-pushed the 26_1__select_by_indexes branch from 560eaee to 7622162 Compare June 5, 2026 12:16
Copilot AI review requested due to automatic review settings June 5, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 changed files in this pull request and generated 4 comments.

Comment thread packages/devextreme/js/common/grids.d.ts Outdated
let current: number[] = [];

sorted.forEach((value) => {
if (current.length === 0 || value === current[current.length - 1] + 1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants