Scroller breaks rowHeight

Scroller breaks rowHeight

WingedFoxWingedFox Posts: 4Questions: 0Answers: 0
edited May 2012 in Bug reports
Hello,

When i explicitly define rowHeight
1) it does not block auto measure feature (which works incorrectly for me because of tooo complex page layout
2) when i set autoHeight to false Scroller dies with NaN
this happens because of

[code]
/* Initial size calculations */
if ( this.s.rowHeight != 'auto' )
{
this.s.rowHeight = false;
}
[/code]

Here is the fix
[code]
/* Initial size calculations */
if ( this.s.rowHeight && this.s.rowHeight != 'auto' )
{
this.s.autoHeight = false;
}
[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Are you setting the value to boolean false? I hadn't really expected that - the documentation notes that an integer or a string value is expected: http://datatables.net/docs/Scroller/1.0.2/Scroller.oDefaults.html#rowHeight . If you are doing it by CSS, you need to pass the row height value in.

    Allan
  • WingedFoxWingedFox Posts: 4Questions: 0Answers: 0
    I'm trying to set rowHeight explicitly to 21px, but automatic measurement gives me 18px, which is wrong.

    With my patch i'm going to change constructor to make a check "if rowHeight is set and its value is not 'auto' then disable automatic height calculation" instead of "if rowHeight is not 'auto' then set it value to 'false'"

    Here is the step by step explanation
    1.
    [code]
    oScroller : {
    rowHeight: "21"
    }
    [/code]
    results in 18px auto calculated height, because "this.s.rowHeight" is not equal to "auto", it's set to "false" in constructor and later is automatically calculated

    2.
    [code]
    oScroller : {
    rowHeight: "21",
    autoHeight: false
    }
    [/code]
    results in broken calculations (NaNs) because of
    a) "this.s.rowHeight" is not equal to "auto", it's set to "false" in constructor
    b) fnMeasure does not call to this._fnCalcRowHeight(); because autoHeight is set to false
  • WingedFoxWingedFox Posts: 4Questions: 0Answers: 0
    Should I make a .diff?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Ah yes I see what you mean. That's certainly a bug. Thanks for clearing that up! I'll get a fix committed shortly.

    Allan
  • WingedFoxWingedFox Posts: 4Questions: 0Answers: 0
    You're welcome.
    Thank you for the great tool!
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Sorry for the delay in getting this into Scroller - it is now in 1.0.3.dev and will be in 1.0.3 final :-)

    Thanks again for picking this up!

    Regards,
    Allan
This discussion has been closed.