Closed robmim closed 4 years ago
Implementing ARIA in this component would be a great feature. You can check Table Tree from atlaskit for example. Using aria-expanded="true/false" this way i could at least apply style on the button based on the value of this attribute. ;)
https://atlaskit.atlassian.com/packages/design-system/table-tree
We can't use this component from Atlaskit because of performance issues. Having this feature on your would be awesome.
Hi @robmim,
I've just released a new version which introduces isExpanded
as a property on the RowState
object.
You can now access the expanded/collapsed state of a node inside the cell renderer through row.$state.isExpanded
:
...
renderCell = (row) => {
return (
<button
onClick={row.toggleChildren}
disabled={!row.metadata.hasChildren}>
{row.$state.isExpanded ? '-' : '+'}
{row.data.name}
</button>
);
}
...
You can take a look at this JSFiddle for a full demo.
I can't thank you enough. This little piece of code give so much more value to your component. Great job by the way ;)
Is there any way to know if a row has children visible in v1 ?
I want to boost the ui/ux by changing this black triangle used to mark rows with childrens but i'm stock simply because i can't know if it is expanded or not.
Am i missing something ?