scrollY percentage instead of width
scrollY percentage instead of width

Is there a way to use a percentage value for scrollY instead of pixels?
Setting pixels doesnt look very nice if the user resizes the window and would rather have the table always be 100% of the window height, but show the scroll bar if there are more entries than can be shown for that given height
This discussion has been closed.
Replies
Percentage height doesn't work well in CSS. However, you can use
vh
units:scrollX: '90vh
- example, which does work well.Alternatively, I wrote a "fit to container" plug-in for the scrolling a little while ago which you can find here.
Allan
I took a look at scrollResize but cant seem to get it to work as the whole page just keeps scrolling if I have too many entries:
Ive noticed this with some other plugins, but does scrollResize interact negatively with any of the things I have turned on?
I would need a link to the page showing the issue to understand why it isn't working for you.
Allan
Heres a link to a test site: http://mytestwebsite123.comli.com/
I was hoping that the datatable would always fit 100% of screen height, but scroll bars appear for the table itself (instead of the page) if there are too many rows
There doesn't appear to be any constraint on the height of the container element. You might set your
#items
element to be 100vh for example.The plug-in I linked to is fit to container as I mentioned, so you need to have the container set to the size you want, like in the examples in that repo.
Allan
ah got it, thanks!