Creating DataTable inside a child row where main table uses row grouping
Creating DataTable inside a child row where main table uses row grouping
chris.durham
Posts: 12Questions: 4Answers: 0
Hi,
Has anyone else come across a situation where you are creating a DataTable in a childrow on the fly and if the main table uses RowGrouping - every time you initialize the DT in the child row it adds an extra RowGroup header to the parent.
I thought the child data was a separate instance and wouldn't affect the parent, but it seems not to be? Or is the rowGroup on the parent being confused by the child table existing..
Any suggestions for workarounds would be appreciated.
This discussion has been closed.
Replies
Ok - done a little more digging (ie stepping through the DataTables.js)
If appears that when initializing the inner table, the private _draw() method is being called on the outer table. However this blindly assumes that the row grouping headers aren't present and draws them all over again.
So either _draw() needs 'fixing' to check whether what it wants to render already exists and not do a insertBefore, but update the existing, or not be called more than once or I need to somehow remove the rowGrouping, initialize the child datatable and then put back the rowGrouping without any nasty redraw issues..
Thoughts?
Ok - so self work-around defined (although it would be nice to have confirmation that this is the 'correct' way of fixing it)
I'm wrapping my child datatable creation with a dt.rowGroup().disable() and dt.rowGroup().enable - where dt is a reference to my parent table..
Seems to solve the problem..
Hope that's useful to someone else in the future at least..
I was having the exact same issue! Your work-around is working for me as well. I just disable row grouping on the parent table and re-enable it after the child table has been initialized (init.dt). Thanks!
thanks, this works for me