bScrollCollapse, cutom headers

bScrollCollapse, cutom headers

GerardoGerardo Posts: 66Questions: 0Answers: 0
edited February 2011 in General
I use fnDrawCallback to add custom daily headers, tking a full row.

Right now, I am filtering, seeing 3 rows, however have to scroll because the first row is the header, see 2 more rows and for the 3rd row of data have to scroll to see it.

Not sure on how to fix.

Thanks,
Gerardo

Replies

  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    any takers?

    Thanks,
    Gerardo
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Hi Gerardo,

    I'm afraid I'm not sure I fully understand - you see three rows, but you have to scroll to see the 3rd row's data? Can you link us to an example please?

    Regards,
    Allan
  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    Right, because the first row is a non data header, so I see 1 row of header, 2 rows of data, and the scroll bar is still there (even when 3 and 4 rows fit in the screen).

    [code]
    for ( var i=0 ; i
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Ah I see - so you are using fnDrawCallback to insert TR elements which you have 'manually' added. Okay, no problem - so what I suspect the problem is, will be that you have the bScrollCollapse parameter: true, and DataTables is calculating the height to collapse the wrapper element around the table to, just before fnDrawCallback. So what you can do is set the collapse height yourself at the end of your callback function. Something like:

    [code]
    oSettings.nTable.parentNode.style.height = $(oSettings.nTable).height()+"px";
    [/code]
    Allan
  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    Perfect.

    Thanks,
    Gerardo
  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    talked a bit too soon, this affects scrolling.

    must do it only if this value is less than sScrollY (oSettings.sScrollY? )

    Thanks,
    Gerardo
  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    Found it, oSettings.oScroll.sY

    Gerardo
  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    Settled on this code:

    [code]
    oSettings.nTable.parentNode.style.height =
    Math.min($(oSettings.nTable).height(),oSettings.oScroll.sY)
    + "px";
    [/code]

    This way, it collapses when it is right, and also goes back to full size when it is right (for example, after putting/clearing a filter).

    But turned out bScrollCollapse was gone at this time, and when it is turned on, the above code is now not necessary.

    Thanks,
    Gerardo
  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    Talked too soon, still necessary.

    Thanks,
    Gerardo
This discussion has been closed.