Skip to content
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

TreeList getSelectedState fails with enabled virtual scrolling #1535

Closed
kdikov82 opened this issue Apr 7, 2023 · 6 comments
Closed

TreeList getSelectedState fails with enabled virtual scrolling #1535

kdikov82 opened this issue Apr 7, 2023 · 6 comments
Labels
Bug Item which indicates that something is not working KendoReact pkg:Grid pkg:Treelist triaged mark the triaged issues with correct priority

Comments

@kdikov82
Copy link
Contributor

kdikov82 commented Apr 7, 2023

The aria-rowIndex and data-grid-row-index are wrongly set when you scroll the TreeList to render new view when virtual scrolling is enabled. This causes the getSelectedState to return the wrong data key value, thus creating a wrong selected state:

As a temporary workaround, the data key values can be added manually to the TR element and a custom logic for the selected state can be applied:

@kdikov82
Copy link
Contributor Author

kdikov82 commented Jun 2, 2023

The same issue is observed with the Grid

@filipKovachev
Copy link
Contributor

Reported again in Ticket ID: 1619793

@helm100
Copy link

helm100 commented Sep 6, 2023

For the Grid, I could create a workaround by adding 'skip' to the GridSelectionChangeEvent's start and endRowIndex:

const onSelectionChange: (e: GridSelectionChangeEvent) => {
    // When virtual scrolling is enabled, we should add the amount of skipped records to the event
    e.endRowIndex += skip;
    e.startRowIndex += skip;
    const newSelectedState = getSelectedState({
        event: e,
        selectedState: selectedIdsState,
        dataItemKey: idFieldName
    });
    setSelectedIds(newSelectedState);
};

Working example: https://codesandbox.io/s/stoic-euclid-3t4ckp?file=/app/main.tsx

@iadnonov
Copy link

iadnonov commented Jun 5, 2024

Reported again in #2288

@WissamProgress
Copy link
Collaborator

For the Grid, there is a regression between versions 7.3.0 and 7.4.0

For 7.3.0 it was working - https://stackblitz.com/edit/react-kenryc-hgt7wj?file=package.json

For 7.4.0 it stopped working - https://stackblitz.com/edit/react-kenryc-amrqfp?file=package.json

@WissamProgress WissamProgress added Regression Regression bug triaged mark the triaged issues with correct priority and removed SEV: Critical Regression Regression bug labels Jun 5, 2024
@iadnonov
Copy link

Fixed in dev version 8.1.0-develop.19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Item which indicates that something is not working KendoReact pkg:Grid pkg:Treelist triaged mark the triaged issues with correct priority
Projects
None yet
Development

No branches or pull requests

6 participants