FixedColumns not factoring hidden columns into rendering

FixedColumns not factoring hidden columns into rendering

WeaponX86WeaponX86 Posts: 40Questions: 0Answers: 0
edited April 2012 in Bug reports
My declaration:
[code]
new FixedColumns(oTable,{
"iLeftColumns": 0,
"iRightColumns": 1
});
[/code]

In FixedColumns.js (full source) line ~403 it says:
[code]
if ( that.s.iTableColumns-that.s.iRightColumns <= i )
{
iRightWidth += iWidth;
}
[/code]

In my case,
that.s.iTableColumns = 19 but only 15 are actually visible so using this declaration creates an off screen fixed column.

that.s.iTableColumns = 19
that.s.iRightColumns = 1

"i" only goes up to 14 because there are only 15 actual columns, thusly iRightWidth never gets set.

Replies

  • WeaponX86WeaponX86 Posts: 40Questions: 0Answers: 0
    Here is the fix I came up with (FixedColumns.js (full source) line ~403):
    [code]
    shownCols = $('tbody>tr:eq(0)>td', this.s.dt.nTable);

    shownCols.each( function (i) {
    iWidth = $(this).outerWidth();
    that.s.aiWidths.push( iWidth );
    if ( i < that.s.iLeftColumns )
    {
    iLeftWidth += iWidth;
    }
    if (shownCols.length-that.s.iRightColumns <= i )
    {
    iRightWidth += iWidth;
    }
    } );
    [/code]
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Nice one - thanks for the fix :-). I'll look at putting this in tot he next release of FixedColumns as that looks good to me!

    Regards,
    Allan
  • WeaponX86WeaponX86 Posts: 40Questions: 0Answers: 0
    edited April 2012
    So far this fix works well except in IE7. It throws a javascript error on this line in multiple places (~856, ~942, and ~950):

    oStyle.width = that.s.aiWidths[iColumn]+"px";

    This is because later on in the script there are more loops that aren't taking the hidden columns into account.
This discussion has been closed.