RowGroup 1.0.0 sets colspan=0 when table is hidden
RowGroup 1.0.0 sets colspan=0 when table is hidden

RowGroup 1.0.0 has a bug where it sets "colspan=0" if the datatable is hidden during initialisation. This looks like the same issue as a generic case in the main code:
https://github.com/DataTables/DataTablesSrc/commit/9946f7c81e530c0fcf65f0bd38ea5364741bb268
It looks like RowGroup uses this same "filter(':visible')" code, but I can't see exactly how to modify it in the same way as the main code change.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Its here. That code should probably be updated to be:
which I believe should do the trick.
Rushing a little at the moment I'm afraid so I've not actually tried it out yet.
Allan
Thanks for the quick reply! Unfortunately replacing that line with the code you gave seems to behave in exactly the same way (returning colspan=0 if the table is initially hidden). I'm sure I'm running the patched version as I put a breakpoint on the relevant line...
This one will do it:
That uses the
columns().visible()
method which only checks the visible flag of the column and not if it is actually in the document or not. It then usesreduce()
to basically sum the values.Allan
Unfortunately this also doesn't seem to work. Putting a breakpoint on the "return" statement shows "a: 0" and "b: false". The complete code fragment from my modified source:
_colspan: function ()
{
// return $( this.s.dt.columns().header() ).filter(':visible').length;
this.s.dt.columns().visible().reduce( function (a, b) { return a + b; }, 0 )
},
It would need to be:
Allan
Thank you so much! I can confirm that code works correctly in my test; apologies for mis-implementing your original code and missing the extra return.
Thanks again for developing such an awesome tool!
Excellent - great to hear that helped. I'll test it locally as well and then include it in the RowGroup extension.
Thanks for the feedback!
Allan
Just a quick update here - I've finally committed the fix. The nightly will update with the change shortly.
Regards,
Allan