Skip to content

[Grid]: Multiple selection and paging not work togehter #1142

@stormenergy91

Description

@stormenergy91

I have a Grid with AllowPaging, AllowSelection, and SelectionMode="GridSelectionMode.Multiple". I configured a DataProvider for client-side mode.

Selection and paging work, but when I select some items and then change the page, the selection is cleared. I tried storing SelectedItems in a local variable, but that didn't help.

I also noticed that every time I change the page, the SelectedItemsChanged function is called. So, in that function I added something like:

if (items is not null && items.Count > 0)
{
    foreach (var item in items)
    {
        if (!SelectedItems.Any(s => s.Id == item.Id))
        {
            SelectedItems.Add(item);
        }
    }
}

to keep the selected items, but if I change page in a one with items selected, in the Grid those are non seletect.

I try also

private async Task<GridDataProviderResult<MyItem>> TableItemsResultDataProvider(GridDataProviderRequest<MyItem> request)
{
    var result = await Task.FromResult(request.ApplyTo(TableItems));
    itemsGrid.SelectedItems = SelectedItems;
    return result;
}

But items alread not selected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions