Mui-datatables: Having conditionnal expandable rows

Created on 9 Apr 2019  路  9Comments  路  Source: gregnb/mui-datatables

In datatable, i tried to have rows which are expandables and some none
see : https://codesandbox.io/s/qq6858v6qj

Expected Behavior

the rows which don't have childs should not have an expand button

Current Behavior

the rows with no child have an expand button

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | 3.2.2 |
| MUI-datatables | 2.0.0-beta-51 |
| React | 16.4.0 |
| browser | Chrome Version 73.0.3683.103 (Official Build) (64-bit) |
| etc | |

new feature

Most helpful comment

yeah, in my datasource i have some master rows, in these rows i can have childs rows or nothing, so yes i can have some rows expandable and some not in the same datatable, that's why i want to hide the expand button when i don't have childs rows , and i'm wondering if it's possible with this actual version of the datatable

All 9 comments

i don't really understand this answer , sorry

So what you are asking is for the ability to have some rows expandable and some not?

yeah, in my datasource i have some master rows, in these rows i can have childs rows or nothing, so yes i can have some rows expandable and some not in the same datatable, that's why i want to hide the expand button when i don't have childs rows , and i'm wondering if it's possible with this actual version of the datatable

So what you are asking is for the ability to have some rows expandable and some not?

Yes, Please

I think having an isRowExpandable option, just like we already have an isRowSelectable option, would be a good way to provide this functionality.

When will this be merged to master?

Probably the release after the next one (so two releases). Could be as soon as a week or two. There are some additional things I wanted to do with expandable rows that I want to bundle in the same release with this one, but I haven't had a chance to work on it yet, as other issues have taken priority.

thank you,
while trying to work with this branch it seems that when isRowExpandable is false, the indication arrow is still visible but only click is disables, am i right?
and can we send also to isRowExpandable: (dataIndex, expandedRows) rowMetadata as well ,so we can make condition such has only if rowMeta has certain info it is expandable.

Was this page helpful?
0 / 5 - 0 ratings