table width issue: server-side processing, JSON, and IE
table width issue: server-side processing, JSON, and IE
martin@sommer.net
Posts: 15Questions: 0Answers: 0
I am using server-side processing with Ajax and JSON. When the rows are returned to Firefox, the table width is perfect. With the same rows returned to IE, the table extends off the right side of the page.
What does IE need to maintain a proper DataTable width, that Firefox does not?
Thanks,
Martin
What does IE need to maintain a proper DataTable width, that Firefox does not?
Thanks,
Martin
This discussion has been closed.
Replies
I'm not entirely sure to be honest! I don't recall coming across something quite like this before. Can you post a link which shows it in action? The easiest thing to do would be to add an absolute width to the div.dataTables_wrapper element...
Allan
Adding an absolute width in the dataTables_wrapper works for client-side data, but not when using server-side processing, and the XHR request (within IE).
From what I understand in reading some of your other posts, the column widths (and ultimately the table width) are calculated in a temp table. Is there a way to recalculate, once the XHR request has completed?
Thanks again,
Martin
I've replied by e-mail, but just for reference, yes the width can be recalculated using fnAdjustColumnSizing (it does the table as well) - updating any row will force it as well. However, I'm not sure that these functions which help with what you are seeing... Looks like a slightly different issue to me :-).
Allan
Thanks again for your help!
1. You were right, fnAdjustColumnSizing did not matter, but just for anyone else's future use, here is your code for reference:
[code]
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../examples_support/server_processing_post.php",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(json){
fnCallback(json);
oTable.fnAdjustColumnSizing();
}
} );
}
} );
} );
[/code]
2. Turns out that changing the '\n' to '
' did work! Because IE was caching the data, I did not realize it first time through.
Thanks again!
Martin
Good to hear that got it sorted! Are you using DataTables 1.6 or before? 1.7 should be using jQuery's anti-cache option (since IE is a proper pain when it comes to doing GET AJAX cache...).
Allan
Thanks again,
Martin