Grid: OnRowClicked is fired on load

1 Answer 74 Views
Grid
Holger
Top achievements
Rank 1
Iron
Iron
Holger asked on 05 Apr 2022, 07:08 AM

Hello,

I have a TelerikGrid like this:

<TelerikGrid @ref="gridRef"
Data="@MyData" 
Pageable="@pageable" 
PageSize="15"
Sortable="true"
SelectionMode="GridSelectionMode.Single"
SelectedItemsChanged="@((IEnumerable<MyDataViewModel> itemList) => OnRowClick(itemList))"
SelectedItems="selectedRow"
OnRowDoubleClick="@OnRowDbClick"
OnRowContextMenu="@Menu"
OnStateInit="@((GridStateEventArgs<MyDataViewModel> args) => OnStateInitHandler(args))">

Works fine.

But on page load, my OnRowClick-method will be fired with an empty [] as parameter.

Is that working correctly?

In my case, I can make a workaround for that, but maybe that is not the designed behaviour? :-)

Runs on .net6.0.3. Testet on Firefox on Windows10. Telerik.UI.for.Blazor 3.1.0

1 Answer, 1 is accepted

Sort by
0
Nadezhda Tacheva
Telerik team
answered on 07 Apr 2022, 04:21 PM

Hi Holger,

Thank you for reaching out! You are correct, this behavior is not expected.

As per your configuration, the OnRowClick method is an event handler of the SelectedItemsChanged event. It is supposed to fire when there is a change in the user selection. However, it looks like it is indeed currently fired on initialization when no items are even selected yet. If the user clicks once more on an already selected row, the SelectedItemsChanged event fires again although there is no change in the selection (this is not desired as well).

I've logged a public bug report on your behalf, you can find it in our feedback portal here: SelectedItemsChanged event is fired when there are no changes in the selection.

I added your vote to increase its popularity as we are prioritizing the bug fixes based on the community demand. As creator, you are automatically subscribed and will receive email notifications for its status updates. This is the best way to keep in track with the progress of the bug as once we know which release will contain its fix, we will update its status in the feedback portal and you will be notified via email accordingly.

Last but not least, as a small gesture of gratitude for reporting this, I have rewarded your account with some Telerik points.

Regards,
Nadezhda Tacheva
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/.

Tags
Grid
Asked by
Holger
Top achievements
Rank 1
Iron
Iron
Answers by
Nadezhda Tacheva
Telerik team
Share this question
or