Last Updated: 17 Sep 2020 13:04 by ADMIN
Created on: 16 Aug 2020 05:59
Category: Grid
Type: Feature Request
Focusin event for grid rows

I want to know when the user moves focus to a new row - I intend to use that to select this row and to perform some operations on an adjacent grid.




Exposing similar keyboard events and actions from the grid will have the following major downsides:

  • First and foremost - Performance. Handling so many events will have a dramatic impact on the performance of the grid as each EventCallback re-renders the component twice. If we stop that re-rendering to keep the performance up to standards, you won't be able to change grid settings (such as selected items, edited row, etc.) and that will make the event next to useless.
  • Complexity - there is an incredible amount of information that such an event needs to carry in order to be useful - keys, modifier keys, current element (and obtaining element refs in blazor is another problem that causes performance issues), current model, adjacent models, whether the event happened on a data cell, header cell, or any of the dozens of possible elements in the grid. This list is also by no means exhaustive, there will be many more cases that I can't even thing of right now. This will make such events extremely complex and uncomfortable to use. An alternative would be exposing many events for many different elements, which will make the performance issue even worse.
  • Cost-benefit analysis - the majority of things are possible through templates right now. You can put in the desired template (editor, row, cell, header, whatever you need to capture events from) and add the desired handler to your own DOM element. Then, you can alter the grid, if needed, through its state. If you need the row data item - it is available in the templates related to the data rows. If you need adjacent rows models - you can get them from the sorted list of grid data when you use its OnRead event - you have the current row and you can get a previous/next one as needed from that list.

That said, I am keeping this item open (status "Unplanned") so we can still gather any feedback and its popularity and what the community thinks, and whether it will be a meaningful addition to the component.