Replies: 2 comments 3 replies
-
Same here, I'm struggling to understand this library, it doesn't make sense that we have to manually update the expanded rows state when sorting / filtering, this should be handled by this library |
Beta Was this translation helpful? Give feedback.
-
I figured out why this is This answers my questions (1) - (3), above:
This all seems pretty sensible (though I would argue that the type should just be |
Beta Was this translation helpful? Give feedback.
-
ExpandedState
looks like this:From this I expected the
string
to be some kind of unique ID on the row -- but best I can tell from the example, it's actually a map of row index (i.e., a number) toboolean
.Questions:
Record<number, boolean>
? Or is it not always the row index?expanded
state?Record<unique row id, boolean>
so that the state persists across sorting, filtering, etc? (I don't know if it's possible to define a unique id on a row with Tanstack; many grids (e.g. MUI's) require that every record have a unique ID for this purpose.)On the final point -- in general the Tanstack docs seem to do a great job of telling me the Typescript types I'm dealing with -- much appreciated -- but not such a hot job of telling me what anything actually means. The Expanded State API section would be far more useful if it included a simple comment like "expanded state is a map from the row index to a boolean" (or whatever it actually is). As it stands I'm left trying to piece this together from the example. (Obviously it would be even more helpful with notes about what happens on sorting & filtering, etc.)
Beta Was this translation helpful? Give feedback.
All reactions