Scrollbar width function cannot be accessed in 1.10.0

Scrollbar width function cannot be accessed in 1.10.0

jolyon2000jolyon2000 Posts: 12Questions: 0Answers: 0
edited March 2014 in Bug reports
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.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    The `_fnScrollBarWidth` function is a private function and should not be used externally. Private functions can and will change between versions - otherwise there would never be any development done!

    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
  • jolyon2000jolyon2000 Posts: 12Questions: 0Answers: 0
    I got the scrollbar width using:

    var scrollbar_w = $.fn.dataTableSettings[0].oScroll.iBarWidth;

    Is this advisable?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    As I say, no. Nothing from the settings object should be used externally unless you are happy with ensuring that your software is compatible with each upgrade. The settings object is considered to be private. Its contents can, will and do change between releases.

    Allan
This discussion has been closed.