The properties that are included in the arguments that are passed into the rowSelecting, rowSelected, rowDeselecting, and rowDeselecting events differ based on what the exact trigger of those events is. Because of this, the properties don't always match the documentation or the TypeScript type definitions for those event args. Looking at the below documentation, I'll list all the discrepancies I've discovered. The TS type definitions do match the documentation, so they are incorrect in the same ways as the docs.
- rowSelectEventArgs is always missing the cancel property. I realize this would default to false anyway, so having it undefined probably doesn't really affect anything. But, it should be consistent with rowSelectedEventArgs and rowDeselectEventArgs, both of which do include the cancel property, set to false.
- rowDeselectEventArgs has arrays for the data, foreignKeyData, row, and rowIndex properties, even if there's only a single row being deselected, but the docs and TS typings don't indicate that these are arrays.
- If you are doing something that could select multiple rows, either by checking the checkbox in the header or calling selectRowsByRange() or selectRows(), even if only a single row is affected, there is a rowIndexes property on both the rowSelectingEventArgs and rowSelectEventArgs. This property isn't documented or included in the TS typings.
- If you are
doing something that could select multiple rows, even if only a single row is affected, the data property on rowSelectEventArgs is an array of values, even though it's documented as a single value. Note that this is different than rowSelectingEventArgs, where data is a single value (I believe it's the data for the first row being selected). So, even though rowSelectingEventArgs does match the documentation in this case, it's very difficult to get the data for all the rows being selected in the rowSelecting event.
- If you are
doing something that could select multiple rows, even if only a single row is affected, the foreignKeyData and isInteracted properties are missing from rowSelectingEventArgs.
Having these incorrect in the documentation makes it very difficult to understand how to work with these events correctly. Having them incorrect in the TS type definitions makes them hard to work with, since our code has to cast them as any
to be able to work with the correct properties, which is obviously prone to errors.