Unplanned
Last Updated: 30 Jan 2024 13:41 by ADMIN
Bob
Created on: 23 Aug 2021 09:02
Category: Grid
Type: Bug Report
17
SelectedItemsChanged event with async handler is not firing when you unselect checkbox row in Grid

I have a Grid using checkbox selection and when I un-check a row, the SelectedItemsChanged event is not firing. I'm using an async handler.

The problem appears to happen when a row is selected and then un-selected. The event is firing when it is selected but is not firing when it is un-selected.

<TelerikGrid Data="strategicLevelItems" SelectedItems="selectedStrategic" Width="100%" Height="500px"
                                 ScrollMode="GridScrollMode.Scrollable" SelectionMode="GridSelectionMode.Multiple"
                                 SelectedItemsChanged="@((IEnumerable<GetNavigationNodesModel> strategicItems) => OnStrategicSelectAsync(strategicItems))"
                                 FilterMode="GridFilterMode.FilterRow">
                        <GridColumns>
                            <GridCheckboxColumn SelectAll="true" Width="40px" OnCellRender="@GridHelpers.CenterAlign" />
                            <GridColumn Field="@(nameof(GetNavigationNodesModel.Name))" />
                        </GridColumns>
                    </TelerikGrid>

    private async Task OnStrategicSelectAsync(IEnumerable<GetNavigationNodesModel> selectedItems)
    {
        selectedStrategic = selectedItems;

        var state = tacticalGrid.GetState();

        var compositeFilter = new CompositeFilterDescriptor() { LogicalOperator = FilterCompositionLogicalOperator.Or };
        foreach (var item in selectedItems)
        {
            compositeFilter.FilterDescriptors.Add(new FilterDescriptor()
            {
                Member = "ParentId",
                Operator = FilterOperator.IsEqualTo,
                Value = item.Id
            });
        }

        state.FilterDescriptors.Clear();
        state.FilterDescriptors.Add(compositeFilter);

        await tacticalGrid.SetState(state);
    }

4 comments
ADMIN
Dimo
Posted on: 31 Aug 2023 05:22

Hello Tommi,

Please refer to my previous post below and let me know if you need additional information. I hope an async RowClick handler is a feasible workaround for you.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
TWK
Posted on: 30 Aug 2023 16:42
Two years later, still not update on this bug?
ADMIN
Dimo
Posted on: 01 Sep 2022 08:59

Hello Tobias, and anyone else who is interested in this thread,

We expect the SelectedItemsChanged handler to be synchronous, otherwise the selected items will not update correctly. .NET 7 will provide enhancements related to async changed handlers, but we will continue to support .NET 6, according to Microsoft .NET LTS.

In other words, we can revisit this issue after we drop support for .NET 6. In the meantime, please execute async app logic in row click handlers.

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tobias
Posted on: 25 Aug 2022 12:06
a year later, is there any update on this bug?