tables behind tabs...

tables behind tabs...

brianmmbrianmm Posts: 41Questions: 0Answers: 0
edited August 2009 in General
Hello Allan,

I'm using Yetii ( http://www.kminek.pl/lab/yetii/ ), and have a databale behind a tab.

Now I have tried with set widths and with %-ages, but either way does nto render the table correctly untill the page is refreshed.

Here is imy wee bit of JS which I am now trying ... which I am sure is wrong :) but is it possible if so help! :)

Cheers!



function customfunction(tabnumber) {
if (tabnumber==4) {
alert('You clicked tab number 4');
var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable();
oTable.fnDraw();
});
}
}

var tabber1 = new Yetii({
id: 'hubtab',
persist: true,
callback: customfunction
});

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    What I think it happening here is that the algorithm that DataTables uses to calculate the optimal column widths (to stop paging jumping the columns around) requires that the table have a calculated offsetWidth by the browser. If you table is not in the flow of the document, then it is quite reasonable for the browser to have optimised this and not calculate the width of the table. As such DataTables gets a 0 (or possibly null) values and freaks out a little bit...

    I'd support perhaps a couple of options to try:

    1. Set a fixed width for your table using style="width:800px" or whatever
    2. Set bAutoWidth to 0.
    3. A combination of the two :-)

    Hopefully that will do the trick for you. I'll have a think about how I might change the auto width algorithm to take this into account - but I don't really want to change the flow of the document as it might cause some unpleasant rendering side-effects... A tricky one.

    Regards,
    Allan
This discussion has been closed.