ScrollY, header th width not correct

ScrollY, header th width not correct

JovanJovan Posts: 16Questions: 0Answers: 0
edited September 2010 in General
Hi,

I've been having this problem, when scrollY is true my th columns loose ther original width.
But after sorting or paging this width is corected.
Does anybody have a solution to this.
I'm using v1.7.2

Thanks,
Jovan

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Is the table hidden (display: none) when they are initialised? Something like this might help: http://datatables.net/examples/api/tabs_and_scrolling.html

    Allan
  • dennedenne Posts: 30Questions: 0Answers: 0
    thanx for the explanation! I have been searching for why this happens.
  • dennedenne Posts: 30Questions: 0Answers: 0
    btw. What does the ">table.display" part of the selector?
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Not sure quite what you mean. $('table.display').dataTable(...) in the link above will initialise DataTables on any element which matches that selector (i.e. any table element with a 'display' class). See: http://datatables.net/examples/basic_init/multiple_tables.html .

    Allan
  • dennedenne Posts: 30Questions: 0Answers: 0
    I was thinking about the selector "div.dataTables_scrollBody>table.display" in the example.
    Not sure what the ">table.display" do.
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    It just ensures that the table element with a class of display is a child of the div with a class of dataTables_scrollBody: http://api.jquery.com/child-selector/ .

    Allan
  • paulie4paulie4 Posts: 1Questions: 0Answers: 0
    I just ran across a problem with the example in http://datatables.net/examples/api/tabs_and_scrolling.html. It assumes there is only one dataTable in each tab, so any tabs with more than one table will only have one of its tables' columns adjusted. The "show" function for the tabs should be the following:

    var oTables = $('div.dataTables_scrollBody>table.display', ui.panel);
    for (var i = 0; i < oTables.length; i++) {
    var oTable = $(oTables[i]).dataTable();
    oTable.fnAdjustColumnSizing();
    }
This discussion has been closed.