Closed patorjk closed 4 years ago
That option does not yet exist. Marking this as a duplicate as it has come up a number of times. You can follow the threads here for more information: https://github.com/gregnb/mui-datatables/issues/549, https://github.com/gregnb/mui-datatables/issues/518.
It’s similar, though slightly different in that I’m looking to control via the column header. However, marking as a dup is fine, I’ll keep an eye on those other issues.
You can already make custom column headers, so the only part that is missing is a way to programmaticly interact with the expand functionality. So if you had that, you would be able to do what you wanted.
You can only create custom headers for columns in the Columns array. The expandable row options are set on the main options object and there isn’t a way to set its header (at least from what I can tell).
It won't matter which object it's in, you could theoretically track any of it in your state and make any changes you wanted from the header, to the header, whatever, as long as you had the ability to trigger expandability at will.
There’s no customHeadRender for the expandable row column though, you can’t change header for that column.
Now I think that maybe I don't understand your issue. Not sure what you mean by "expandable row column." Expandable rows are rows, so not sure what columns have to do with it. If you want a column header that allows you toggle expandable rows, then that I understand. Maybe I need screenshots or something that demonstrate what you're trying to accomplish.
Sorry if I’m not clear - I’m looking for something akin to the Select All/Unselect All checkbox header that the selectable rows have. So for the expandable rows column (by this I mean the column representing the arrow buttons that are pressed to open a row), I’m looking for an arrow I could push in the column header that would expand all of the rows or collapse all of the rows.
Part of this would be solved by what you’re talking about, but the other piece would be having the ability to have the column header there, since right now there’s no way to set that column header.
Ok, I understand now. This is referred to as the select column since that's what it's used for now. You're right that there's no way currently to change the functionality in it. So you'd need a custom select header, but this is difficult because you'd need a way to maintain select functionality. I have to think about it, but I think it's going to be low priority to be able to customize the select column header this way. The more important ingredient to me is the ability to hook into the expand functionality. With that in place, there will be many options available for how to trigger it, including custom toolbars, custom columns, custom headers, etc. Just not the select header, at least not right away.
Sounds good. I definitely would want to keep the select functionality., I didn't realize it was the same column (though I did notice it and the checkboxes stuck to the left part of the table when the table got too wide - which is useful), so that makes sense.
@patorjk The expand functionality has been upgraded a few times, so I'm open to this contribution now, if you're still interested!
It’s been in the back of my mind, I’ll take a look this coming week and report back.
Sounds good @patorjk. That also gives me time to get in some improvements to expand rows which may or may not impact that work.
I was looking for this option but didn't see it - is there a way to have the header column for the expandable rows have an icon that will Expand/Close all of the rows?