DataTable 1.9.2 width issue during pagination when fluid layout is used in IE (except IE 7)and FF
DataTable 1.9.2 width issue during pagination when fluid layout is used in IE (except IE 7)and FF
Mehul
Posts: 6Questions: 0Answers: 0
Hi,
I was facing rendering issue when I click on number or other button in pagination, it was assigning width to 100% to various elements of datatable, which was forcing div to shrink its contents and based on contents in body and header, the header and body columns no longer remain aligned and of same width, but IE 7 does not show this behavior.
Also, there is a issue in IE9, where if number button is clicked on pagination, it does not change height of div element.
I want to describe solution here as it may be helpful to others.
[code]
var table_width;
$(".dataTable").bind('page',function () {
table_width = $(".dataTables_scrollBody table").width();
}).dataTable({
"bUI" : true,
"sPaginationType" : "full_numbers",
"bPaginate" : true,
"bLengthChange" : true,
"bFilter" : true,
"bSort" : false,
"aaSorting" : [],
"bInfo" : true,
"bAutoWidth" : true,
"sScrollX" : "100%",
"sScrollXInner" : "",
"bProcessing" : true,
"bScrollCollapse" : true,
"iDisplayLength" : 10,
"fnDrawCallback":function (oSettings) {
if (!($.browser.msie && $.browser.version == "7.0")) {
$(".dataTables_scrollHead").width(table_width);
$(".dataTables_scrollBody").width(table_width);
$(".dataTables_scrollHeadInner").width(table_width);
$(".dataTables_scrollHeadInner table").width(table_width);
$(".dataTables_scrollBody").width(table_width);
}
// fix for IE9 height issue
if ($.browser.msie && $.browser.version == "9.0") {
$(".dataTables_scroll").height($(".dataTables_scrollHead").height() + $(".dataTables_scrollBody").height() + 30);
}
}
});
[/code]
If somebody has better solution, please provide your inputs here.
Thanks,
Mehul Patel
I was facing rendering issue when I click on number or other button in pagination, it was assigning width to 100% to various elements of datatable, which was forcing div to shrink its contents and based on contents in body and header, the header and body columns no longer remain aligned and of same width, but IE 7 does not show this behavior.
Also, there is a issue in IE9, where if number button is clicked on pagination, it does not change height of div element.
I want to describe solution here as it may be helpful to others.
[code]
var table_width;
$(".dataTable").bind('page',function () {
table_width = $(".dataTables_scrollBody table").width();
}).dataTable({
"bUI" : true,
"sPaginationType" : "full_numbers",
"bPaginate" : true,
"bLengthChange" : true,
"bFilter" : true,
"bSort" : false,
"aaSorting" : [],
"bInfo" : true,
"bAutoWidth" : true,
"sScrollX" : "100%",
"sScrollXInner" : "",
"bProcessing" : true,
"bScrollCollapse" : true,
"iDisplayLength" : 10,
"fnDrawCallback":function (oSettings) {
if (!($.browser.msie && $.browser.version == "7.0")) {
$(".dataTables_scrollHead").width(table_width);
$(".dataTables_scrollBody").width(table_width);
$(".dataTables_scrollHeadInner").width(table_width);
$(".dataTables_scrollHeadInner table").width(table_width);
$(".dataTables_scrollBody").width(table_width);
}
// fix for IE9 height issue
if ($.browser.msie && $.browser.version == "9.0") {
$(".dataTables_scroll").height($(".dataTables_scrollHead").height() + $(".dataTables_scrollBody").height() + 30);
}
}
});
[/code]
If somebody has better solution, please provide your inputs here.
Thanks,
Mehul Patel
This discussion has been closed.
Replies
[code]
var fnDrawCallback = function (oSettings) {
// called after processing is done by plug in
if (!($.browser.msie && $.browser.version == "7.0" && $.browser.opera)) {
$(".dataTables_scrollHead").width(table_width);
$(".dataTables_scrollHeadInner").width(table_width);
$(".dataTables_scrollHeadInner table").width(table_width);
if (!($.browser.msie && parseInt($.browser.version.slice(0,1)) > 8)) {
$(".dataTables_scroll").width("100%");
}
}
if($.browser.msie || $.browser.mozilla) {
// not for chrome, opera, safari
if (!($.browser.msie && $.browser.version == "7.0")) {
$(".dataTables_scrollBody").width(table_width);
}
// end
} else {
// for chrome, opera, safari
$(".dataTables_scroll").css("overflow-x", "hidden");
// end
}
if ($.browser.msie && $.browser.version == "9.0") {
$(".dataTables_scroll").each(function(index){
$(this).height($(".dataTables_scrollHead:eq(" +index +")").height() + $(".dataTables_scrollBody:eq(" +index +")").height() + 30);
});
}
}
[/code]
[code]
$(table).bind('page', function () {
if (($.browser.msie && $.browser.version != "7.0") || $.browser.mozilla) {
// called before page length processing is done by plug in
table_width = $(".dataTables_scrollBody table").width();
}
});
$(table).bind('draw', function () {
if (($.browser.msie && $.browser.version != "7.0") || $.browser.mozilla) {
// called before pagination processing is done by plug in
table_width = $(".dataTables_scrollBody table").width();
}
});
$(table).bind('sort', function () {
if ($.browser.msie) {
if (table_width != undefined)
// called before pagination processing is done by plug in
table_width = $(".dataTables_scrollBody table").width();
}
});
$(table).bind('filter', function () {
if ($.browser.msie) {
if (table_width != undefined)
// called before pagination processing is done by plug in
table_width = $(".dataTables_scrollBody table").width();
}
});
[/code]
I hope this may be helpful to others.