DataTables with UI Tabs problem

DataTables with UI Tabs problem

mykg4orcemykg4orce Posts: 2Questions: 0Answers: 0
edited December 2010 in General
hello;

First, great job on this plug-in. You have created a very valuable addition to jQuery.

The problem:

I have implemented two datatables in a jQuery Tab (UI Tabs) identical to the code here: http://www.datatables.net/examples/api/tabs_and_scrolling.html

The problem is that the example is using the "sScrollY" option. I do not want this option. But if I remove this option it removes the from the DOM and renders the following useless.

var oTable = $('div.dataTables_scrollBody>table.display', ui.panel).dataTable();

So now when i go back and fourth between tabs the above line always return oTable.length = 0

As a result my datatable in the 2nd tab does not get proper widths. I want to use 100% width on both datatables.

Replies

  • UPEngineerUPEngineer Posts: 93Questions: 0Answers: 1
    Try this for size. This was one of the original implementations and is what I use.

    [code]
    var oTableInit = $('div.dataTables_wrapper>table.display', ui.panel).dataTable();
    [/code]

    Hope this helps.
  • mykg4orcemykg4orce Posts: 2Questions: 0Answers: 0
    thanks.

    Actually the problem was something else. The example uses the following code to auto adjust the height of the table.
    [code]
    $j("#tabs").tabs( {
    "show": function(event, ui) {
    var oTable = $j('div>table.display', ui.panel).dataTable();
    if ( oTable.length > 0 ) {
    oTable.fnAdjustColumnSizing();
    }
    }
    });
    [/code]

    In my case I do not need this at all. I just needed to add
    [code]"bAutoWidth": false [/code]

    to the settings and i get 100% width.
This discussion has been closed.