Resize bug when using with jQuery Tabs
Resize bug when using with jQuery Tabs
ud3323
Posts: 2Questions: 0Answers: 0
Dear Allen,
DataTables is great, but I think I've found a bug when using DataTables within a jQuery tab. My basic setup is I have a DataTable within a tab and I have a resize event setup on the window so every time the window is resized fnAdjustColumnSizing() is called.
[code]
var dt = $("#table").dataTable(options);
$(window).bind('resize', function() {
dt.fnAdjustColumnSizing();
});
}
[/code]
This works great at resizing the table if the window gets larger, but when shrinking the window the table keeps it's original width and does not adjust. Can you provide some type of workaround for this weird behavior?
DataTables is great, but I think I've found a bug when using DataTables within a jQuery tab. My basic setup is I have a DataTable within a tab and I have a resize event setup on the window so every time the window is resized fnAdjustColumnSizing() is called.
[code]
var dt = $("#table").dataTable(options);
$(window).bind('resize', function() {
dt.fnAdjustColumnSizing();
});
}
[/code]
This works great at resizing the table if the window gets larger, but when shrinking the window the table keeps it's original width and does not adjust. Can you provide some type of workaround for this weird behavior?
This discussion has been closed.
Replies
So while I'm okay with not having the usage of sScrollY, there is still a bug there that needs to be addressed.
> The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width.
Basically, as the message says, when you try to resize the window too small, the columns can't be correctly aligned between the header and the body of the table (since it is really using two different table elements). This looks rubbish, so in order to prevent it, DataTables will refuse to draw the table any smaller. There are a number of options which can help with this:
1. Set the wrapper around the DataTable to overflow: hidden
2. Set a min width on the wrapper to not allow it to get too small
3. Use DataTables 1.8.0 or before which does allow this - but I considered that the bug and fixed it in 1.8.1 (with improvements in 1.8.2.development).
Allan