Disable sScrollY

Disable sScrollY

mimikomimiko Posts: 6Questions: 1Answers: 0
edited August 2013 in General
Hi.

I need to disable sScrollY option in datatable plugin after initialising a table with this option. Regularly users do not need to disable sScrollY, but when they want to print whole table, then prior printing the table must be expanded vertically to all rows. I tried to set sScrollY to a relativelly high value, but not all rows were printed. Also I tried to set sScrollY to its default (empty), with no effect. As a workaround I use fnDestroy() function. But this disables all features like sorting and column ordering. Also in google chrome table becomes for tbody cells without border.

How can this be done with some tabledata's function or setting?

Replies

  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    It can't be disabled after it has been enabled. If you don't want it enabled, you can either not enable it in the first place, or you have to use the destroy as you currently are.

    Making it dynamic would add a significant amount of code to DataTables I think.

    Allan
  • mimikomimiko Posts: 6Questions: 1Answers: 0
    Hi.

    Don't know about how much code will be altered, but simply dinamically setting sScrollY to some other value after initialisation does change vertical view area. So there can be even a bottom line under table to which can be bind an onmove event which will then change sScrollY value accordingly, thus allowing users to adjust vertical view area to theirs needs. Ofcourse after a page refresh, this height will be reset. But I don't use pagination. May be in pagination this will work but will not change the count of rows displayed per page.

    I'm not pro in debugging plugins with classes so maybe there is a chance. Also will be nice to have that kind vertical expanding/compression ov view area using bottom line of the table implemented in Datatables plugin.
  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    Agreed - I'd really like to put in a scrollY option of 100% and have it dynamically use the full height available to it in a constraining container. That's something that I plan to look at while writing the 1.10 documentation.

    Allan
  • mimikomimiko Posts: 6Questions: 1Answers: 0
    Allan, what if constraining container does not exists? Ie parentNode is the window. Setting sScrollY to 100% will expand vertically to window heigh or to show all rows without a viewport scroll? So scroll will be handle by the window itself as it wasn't any sScrollY set at initialization time.
  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    Well this is part of the reason why I haven't do it yet - there are so many variables and things that could do wrong. If you have the table covering the whole viewport though, why wouldn't you just use the browsers native scrolling rather than having DataTables do the scrolling?

    Allan
  • mimikomimiko Posts: 6Questions: 1Answers: 0
    Allan, the only reason I need to expand viewport of the table is to be able to print all rows the table has. This is not happening frequently, but sometime it is needed to print the page.
  • jhcomputejhcompute Posts: 26Questions: 0Answers: 0
    allan,

    Just my two cents. Leave it how it is. Having the container gives a lot of control if needed. This works great in mobile apps for sure.

    mimko,

    I thought when using the tabletools print option it shows the whole table.

    http://datatables.net/extras/tabletools

    It showed the 58 records in whole. Is this not what you are wanting?

    Cheers...
This discussion has been closed.