Scrollbar width function cannot be accessed in 1.10.0
Scrollbar width function cannot be accessed in 1.10.0
jolyon2000
Posts: 12Questions: 0Answers: 0
In 1.10.0, when initializing a datatables object with $("#table").dataTable({... , the _fnScrollBarWidth() function can be accessed via the object. However, when initializing the object using $("#table").DataTable({ , the function is no longer accessible.
This is key to working out the scrollbar width so that it can be taken into account when resizing the datatable height on screen.
This is key to working out the scrollbar width so that it can be taken into account when resizing the datatable height on screen.
This discussion has been closed.
Replies
There is no public API in DataTables for getting the scroll bar width. If you need that information I would recommend you create a function that gives that information outside of DataTables - then it won't matter which version of DataTables you are using.
Related to that, your comment on the `settings()` documentation page won't be published since it is a question - harsh I know, but the comments form does say that questions won't be published as I don't want it to become a discussion forum. That is what this part of the site is for :-).
Requesting the question - as the documentation says, the settings object should not be used externally. Again, it can, will and does change between versions. You should be _very_ familiar with the DataTables internals before using anything in the settings object - that is why there is no example, to discourage its use.
Allan
var scrollbar_w = $.fn.dataTableSettings[0].oScroll.iBarWidth;
Is this advisable?
Allan