scrollY: "auto" ?

scrollY: "auto" ?

Brad SBrad S Posts: 1Questions: 1Answers: 0

My datatable has a fixed header. I am trying to configure it so that the table's scrollable viewport uses all of the leftover vertical height after accounting for the items above and below the table. I would rather not provide a fixed height for scrollY, as different users will be using different display sizes.

I tried scrollY: "auto" but it didn't work.

scrollY: "100%" works to a degree, but the scrolling performance is significantly impacted.

Is there another way to configure DataTables to do this?

Answers

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin

    Have a look at this plug-in. I haven't written up the documentation for it yet, but there is an example in the repo. Basically you need to define a container which has the height you want and this plug-in will make DataTables conform to that height.

    So the key is that you must define a div (or whatever) that will give the height of the container - that is not something the plug-in will do.

    Allan

  • mcranemcrane Posts: 10Questions: 4Answers: 0

    I am trying to do the same thing, and the plug-in works, but not if you use the Scroller plug-in as well. Are these plug-ins compatible?

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin

    I haven't explicitly tested that I'm afraid, so I suspect not. It might be that all you have to do is call scroller.measure() after the resize has happened.

    Allan

This discussion has been closed.