gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.7k stars 931 forks source link

Having conditionnal expandable rows #549

Closed Minifish57 closed 4 years ago

Minifish57 commented 5 years ago

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
wdh2100 commented 5 years ago

https://github.com/gregnb/mui-datatables/blob/master/src/components/TableSelectCell.js line 99 have to think about it here

Minifish57 commented 5 years ago

i don't really understand this answer , sorry

gregnb commented 5 years ago

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

Minifish57 commented 5 years ago

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

bzemms commented 5 years ago

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

Yes, Please

gabrielliwerant commented 5 years ago

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

ruthwe commented 5 years ago

When will this be merged to master?

gabrielliwerant commented 5 years ago

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.

ruthwe commented 5 years ago

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.