fnFakeRowspan and FixedColumns not working
fnFakeRowspan and FixedColumns not working

Hello,
i try to use fnFakeRowspan and FixedColumns toghether but it doesn't work.
As far as I see ... fnFakeRowspan alters oSettings.aoData[...].nTr
while FixedColumns uses oData.anCells
to generate the floating table and than triggers AGAIN the fakeRowspan() functions altering AGAIN oSettings.aoData[...].nTr
so the floating table (the table inside .DTFC_LeftBodyWrapper) will become broken
I solved my problem by modifying a little the fnFakeRowspan plugin :
1. I have changed oData._aData[iColumn]
with _aFilterData[iColumn]
because oData._aData
uses names as index not numbers so $('#example').dataTable().fnFakeRowspan(0);
will not work
2. i have used oData.nTr.childNodes[iColumn].className="d-none";
instead of oData.nTr.removeChild(cell);
because the FixedColumns Extension will trigger again fakeRowspan() that finds a allready modified oSettings.aoData[...].nTr
3. i have also added oData.nTr.childNodes[iColumn].className="d-none";
so the FixedColumns extension will display the floating table well
Note: .d-none { display:none; }
My question is : Do you have a better solution for this situation ?
Below is the modified fnFakeRowspan plugin
function fakeRowspan () {
var firstOccurance = null,
value = null,
rowspan = 0;
jQuery.each(oSettings.aoData, function (i, oData) {
var val = oData._aFilterData[iColumn],
cell = oData.nTr.childNodes[iColumn];
/* Use lowercase comparison if not case-sensitive. */
if (!bCaseSensitive) {
val = val.toLowerCase();
}
/* Reset values on new cell data. */
if (val != value) {
value = val;
firstOccurance = cell;
rowspan = 0;
}
if (val == value) {
rowspan++;
}
if (firstOccurance !== null && val == value && rowspan > 1) {
oData.nTr.childNodes[iColumn].className="d-none";
oData.anCells[iColumn].className="d-none";
firstOccurance.rowSpan = rowspan;
}
});
}
This question has an accepted answers - jump to answer
Answers
Nice change - good to hear you got it working. I don't think there is a better solution at the moment. The whole fake row span thing is a really a bit of a hack as it is!
Allan