Blazorise icon indicating copy to clipboard operation
Blazorise copied to clipboard

Add event callback to datagrid when a cell is navigated

Open mtbayley opened this issue 1 year ago • 7 comments

Is it possible to create an event callback when the DataGrid is navigated via a click or keyboard (arrow keys)? It would return the row object as part of the event args. Bonus if it can also return name of the field in the row clicked.

There is the RowClicked event which captures the click, but does not handle the keyboard navigation.

mtbayley avatar Jul 31 '24 19:07 mtbayley

Everything's possible! haha

Would you be so kind to provide information behind that you're trying to do with listening to these events? Perhaps there could be other ways to solve that problem?

David-Moreira avatar Jul 31 '24 21:07 David-Moreira

I think this can be done as part of the https://github.com/Megabit/Blazorise/issues/5295

stsrki avatar Aug 01 '24 07:08 stsrki

Would you be so kind to provide information behind that you're trying to do with listening to these events? Perhaps there could be other ways to solve that problem?

I would like to display a PDF associated with the row. As the user navigates with cells, the PDF associated with the selected cell would display.

mtbayley avatar Aug 01 '24 12:08 mtbayley

Would you be so kind to provide information behind that you're trying to do with listening to these events? Perhaps there could be other ways to solve that problem?

I would like to display a PDF associated with the row. As the user navigates with cells, the PDF associated with the selected cell would display.

Fair enough, I think https://github.com/Megabit/Blazorise/issues/5295 - SelectedCellChanged is what you want. Anyway it probably won't hurt to introduce the event for further flexibility, we'll let you know once we tackle the feature.

David-Moreira avatar Aug 01 '24 12:08 David-Moreira

As a workaround if you really need to complete your PDF feature, you could probably set up some JS listening to the focus of the cells and invoke a dotnet method or display the PDF.

David-Moreira avatar Aug 01 '24 12:08 David-Moreira

I think that FocusedCellChanged can also be introduced.

stsrki avatar Aug 01 '24 17:08 stsrki

That's too similar to SelectedCellChanged ?

David-Moreira avatar Aug 01 '24 17:08 David-Moreira