DataTable: onRowToggle event returns the wrong type for the data property #3127
Labels
Typescript
Issue or pull request is *only* related to TypeScript definition
Milestone
Describe the bug
When clicking the row expand button, the
onRowToggle
event will log an object of the typeDataTableExpandedRows
, where the keys are thedataKey
s of the toggled rows, and the value is a boolean that says whether the rows are toggled or not when it should log an array of data keys like the typed value suggests.By the way, it only ever shows the ids of the rows that are toggled, so the value is always
true
, hence the suggestion. As the expected type in the d.ts would make most implementations easier without the need to use theObject. keys()
method which is usually what most people want, the keys of the toggled values.But just making the
DataTableRowToggleParams['data']
equals toDataTableExpandedRows
, would fix the issue.Reproducer
https://codesandbox.io/s/epic-sunset-xmuhit?file=/src/demo/DataTableRowExpansionDemo.tsx
PrimeReact version
8.3.0
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
Chrome 103.0.5060.134
Steps to reproduce the behavior
So it doesn't even make sense to have an object for that. A list containing the data keys of the toggled rows makes more sense.
Expected behavior
The console will log an object of the type
Array
containing the data keys of the toggled rows makes more sense. Which could be theany[]
that the typeDataTableRowToggleParams
already specifies for thedata
parameter.The text was updated successfully, but these errors were encountered: