blazorbootstrap icon indicating copy to clipboard operation
blazorbootstrap copied to clipboard

[Grid]: Multiple selection and paging not work togehter

Open stormenergy91 opened this issue 6 months ago • 1 comments

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.

stormenergy91 avatar Jul 14 '25 12:07 stormenergy91

The problem is present also in this page. Try to select some items and than change page.

stormenergy91 avatar Jul 14 '25 12:07 stormenergy91