Resize Scroller Table (especially height) [update]

Resize Scroller Table (especially height) [update]

crakelcrakel Posts: 3Questions: 1Answers: 0
edited May 2014 in DataTables 1.10

Hi,

what's the proper way to resize a DataTable, especially changing the height?

I've been expeimenting with something like the following, but that leads to some new bugs (like scrollCollapse does not work on resized tables or tables without scrollbar break when decreasing height).

Please note, that I use the Scroller plugin!

scrollBody.css('height', newHeight);

table.settings()[0].oScroll.sY = newHeight;

table.columns.adjust(); // seems like not having any effect – vertical scrollbar appears
table.scroller().measure();

Thank you for your suggestions!

crakel.

EDIT: Updated to my latest code.

Answers

  • crakelcrakel Posts: 3Questions: 1Answers: 0
    edited May 2014

    [deleted post – has been settled after DataTables bug fix.]

  • RpiechuraRpiechura Posts: 98Questions: 3Answers: 14

    If you're talking about adding more / less entries on a page and having the table grow then you can use lengthchange (http://datatables.net/reference/option/lengthChange).

    When I wanted the table to grow / shrink on the page I figured out how much space I had available to me in pixels, subtracted off some constants for the search and paging, divided by the height of each row of data and called that function. It took a bit of playing around with but it got the job done.

  • crakelcrakel Posts: 3Questions: 1Answers: 0

    Mhh.. I fear that a Scroller table does not have such an option. Apropos, I resize the tables wrapper using jQuery UI resizable and trigger the DataTables update (first post) at the end of the resizing process.

This discussion has been closed.