FixedHeader fixed left column breaks with rowspan - FIX

FixedHeader fixed left column breaks with rowspan - FIX

mmmgggmmmggg Posts: 5Questions: 0Answers: 0
edited October 2013 in FixedHeader
Hi,

I've modified the FixedHeader code a bit to take into account cells with rowspan when building the FixedLeft table.
I am posting the code, as I am not sure it is the most optimal solution so maybe someone will tweak it in order to be make it worthily to be included in one of the future releases.
It works on my scenario on which I have column 0 having every 3rd row spaning 3 rows down and need to fix first 2 columns

[quote]
-------------
|. |***|***|
|. ----------
|* |***|***|
|. -----------
|. |***|***|
-------------
[/quote]

File "FixedHeader.js"
-->Function: "_fnCloneTLeft"
--->Section: "/* Remove unneeded cells */"
----->Subsection: removal of 'td' elements from each 'tbody > tr'

The code:

[code]
/* Remove unneeded cells */
var sSelector = 'gt(' + (oCache.iCells - 1) + ')';

$('thead tr', nTable).each(function (k)
{
$('th:' + sSelector, this).remove();
});

$('tfoot tr', nTable).each(function (k)
{
$('th:' + sSelector, this).remove();
});

// ----- Modifications start ------------
var irow = 0;
$('tbody tr', nTable).each(function (k)
{
/*
get cell count from all the previous rows having value of
(rowspan + their index) reaching down to the
current row index
( this means that we will remove more cells
from the current row becuase there are rowspans above
reaching down to this row )
*/

var previousRows = $(this).parent().children(":lt(" + irow + ")");

var count = 0;
if (previousRows.length > 0)
{
$(previousRows).each(function (ix, el)
{
var filt = $(el).children().filter(function ()
{
return $(this).attr("rowspan") > irow - ix;
});
count += filt.length;
});
}

/* new selector that taks into account the computed numbers
of previous cells with rowspan extending down */
var sNewSelector = 'gt(' + ((oCache.iCells - 1) - count) + ')';
$('td:' + sNewSelector, this).remove();

irow++;
});
// ----- /Modifications end ------------

this.fnEqualiseHeights('thead', nBody.parentNode, nTable);

[/code]
This discussion has been closed.