Let user turn on scrolling dynamically

Let user turn on scrolling dynamically

iPatchiPatch Posts: 3Questions: 0Answers: 0
edited April 2012 in General
Hello, sorry if this is a stupid question... :-)

I'm trying to give the user an option to turn on scrolling if a table is to large, by checking a checkbox. I'm trying to make the height fit the users viewport, so I want to set sScrollY based on jQuery's $(window).height().

The problem is that I don't really understand how to change the tables settings runtime, so any help would really be appreciated!

Thanks!

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    edited April 2012
    Currently this feature cannot be dynamically enabled and disabled since the HTML structure that DataTables uses for the two types of tables are significantly different. If you wanted to switch between the two you would either have to destroy and recreate the table, or possibly what you could do is always enable scrolling and alter the scroll height - this isn't directly supported, but I think that would work okay (using the fnSettings().oScroll.sY property).

    Allan
This discussion has been closed.