Grid RowSelect not triggering in already selected row

Hello @Team,

What could cause the RowSelect event not being triggered when clicking in an already selected row?

Hi @kim,

The RowSelect will be triggered only when the row is selected - if the row is already selected no event will be raised.

Makes sense. Because I am only reloading the grid if data was saved (after selecting a row), the row stood selected after closing the dialog if pressed the X button. It seems I can basically duplicate the code into the RowDeselect event, but that is just bad practice in my POV. Is there a way to programmatically deselect all rows, besides reloading all data? I tried calling await dataGrid.SelectRow(null); but got an error.

Try DataGrid Reset() method

dataGrid.Reset(resetRowState: true) did the job. Thanks!

It seems this is a change in functionality since 3.1.0, is that correct?

I have added the dataGrid.Reset(resetRowState: true) however that also resets any filters on the Grid. Is there a way to have it that if a Row is already selected, the event can fire again if the same row is selected (the old functionality)?

Yes, in 3.1.0 support was added for multiple selection in the grid. This means that now you can unselect rows. Unfortunately this also broke the RowSelect event for already selected rows when SelectionMode is set to Single.

@enchev Is there a way to use SelectionMode to decide wether or not to select/unselect rows?

  • SelectionMode = Single : every click on a row will select it and trigger the RowSelect event, no matter the row selected status;
  • SelectionMode = Multiple : every click on a row will switch the row's selected status;

I thought I’ve fixed a bug :grinning:. In my opinion the event should be raised only when row is selected not on every click. If you want to execute something on every row click we might expose RowClick event?

Yak shaving :slight_smile:.

This would serve me well. Thanks!

It's already in the master:

It was too late for the release today however it will be part of our release early next week.

1 Like

thank you, much appreciated!