Data Does Not Show /Render in I.E 9
Data Does Not Show /Render in I.E 9
hksd
Posts: 15Questions: 0Answers: 0
Hi All,
i have a problem when using Datatables server side processing with I.E. 9, the data does not showed or rendered. but when i used firefox it run well.
the server side response with json. and using json validation it's tell that the json is valid.
it's look like it failed from var _fnJsonString = (window.JSON) ? JSON.stringify : function( o ) ( My guess).
after look from other discussion http://datatables.net/forums/discussion/700/server-side-processing-hangs-at-loading-data-from-server#Item_22 . it show using json2.js .. i have include it in my html head tag but it does not effect anythink.
here is my json
[code]
{"aaData":[[3,"Sore","asdasd","",""],[2,"Siang","asdasd","",""],[1,"Pagi","D:\\Src\\Pagi","",""]],"iTotalDisplayRecords":3,"iTotalRecords":3,"sEcho":"1"}
[/code]
here is my html
[code]
id
Batch Name
Source Path
edit
delete
jQuery.fn.dataTableExt.oApi.fnFilterOnReturn = function (oSettings) {
var _that = this;
this.each(function (i) {
$.fn.dataTableExt.iApiIndex = i;
var $this = this;
var anControl = $('input', _that.fnSettings().aanFeatures.f);
anControl.unbind('keyup');
$("#btnSearch").bind( "click",function(){
$.fn.dataTableExt.iApiIndex = i;
_that.fnFilter($("#txtSearch").val());
});
return this;
});
return this;
};
var oTable;
$(document).ready(function() {
oTable = $('#batchDT').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "dtbatch.action",
"sServerMethod": "POST",
"aaSorting": [[ 1, "desc" ]],
"sDom" : "ltiprf",
"oLanguage": {
"sInfo": "Total Records : _TOTAL_ ",
"sInfoEmpty": ""
},
'aoColumns': [
{
"sWidth" : '70px',
"bVisible" : false
},
{
"sWidth" : '70px'
},
{
"sWidth" : '70px'
},
{
"sWidth" : '70px',
"bSortable": false,
"sClass": "center",
"sDefaultContent": "Edit",
"fnRender": function ( o, val ) {
return 'Edit';
}
},
{
"sWidth" : '70px',
"bSortable": false,
"sClass": "center",
"sDefaultContent": "Delete",
"fnRender": function ( o, val ) {
return 'delete';
}
}
],
'bFilter':true,
'bInfo': true,
'iDisplayLength': 10,
'sPaginationType': 'full_numbers' ,
"bLengthChange" : false
}).fnFilterOnReturn();
} );
[/code]
i have a problem when using Datatables server side processing with I.E. 9, the data does not showed or rendered. but when i used firefox it run well.
the server side response with json. and using json validation it's tell that the json is valid.
it's look like it failed from var _fnJsonString = (window.JSON) ? JSON.stringify : function( o ) ( My guess).
after look from other discussion http://datatables.net/forums/discussion/700/server-side-processing-hangs-at-loading-data-from-server#Item_22 . it show using json2.js .. i have include it in my html head tag but it does not effect anythink.
here is my json
[code]
{"aaData":[[3,"Sore","asdasd","",""],[2,"Siang","asdasd","",""],[1,"Pagi","D:\\Src\\Pagi","",""]],"iTotalDisplayRecords":3,"iTotalRecords":3,"sEcho":"1"}
[/code]
here is my html
[code]
id
Batch Name
Source Path
edit
delete
jQuery.fn.dataTableExt.oApi.fnFilterOnReturn = function (oSettings) {
var _that = this;
this.each(function (i) {
$.fn.dataTableExt.iApiIndex = i;
var $this = this;
var anControl = $('input', _that.fnSettings().aanFeatures.f);
anControl.unbind('keyup');
$("#btnSearch").bind( "click",function(){
$.fn.dataTableExt.iApiIndex = i;
_that.fnFilter($("#txtSearch").val());
});
return this;
});
return this;
};
var oTable;
$(document).ready(function() {
oTable = $('#batchDT').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "dtbatch.action",
"sServerMethod": "POST",
"aaSorting": [[ 1, "desc" ]],
"sDom" : "ltiprf",
"oLanguage": {
"sInfo": "Total Records : _TOTAL_ ",
"sInfoEmpty": ""
},
'aoColumns': [
{
"sWidth" : '70px',
"bVisible" : false
},
{
"sWidth" : '70px'
},
{
"sWidth" : '70px'
},
{
"sWidth" : '70px',
"bSortable": false,
"sClass": "center",
"sDefaultContent": "Edit",
"fnRender": function ( o, val ) {
return 'Edit';
}
},
{
"sWidth" : '70px',
"bSortable": false,
"sClass": "center",
"sDefaultContent": "Delete",
"fnRender": function ( o, val ) {
return 'delete';
}
}
],
'bFilter':true,
'bInfo': true,
'iDisplayLength': 10,
'sPaginationType': 'full_numbers' ,
"bLengthChange" : false
}).fnFilterOnReturn();
} );
[/code]
This discussion has been closed.
Replies
Allan
How do you do?
i have try your suggestion but it seem like it take to long time or hang or datatables debugger status is uploading data to server
Best Regards,
Handinata Kusuma
If i Debug in Firefox is it okay? it look like in I.E the datatables debugger is hang
Best Regards,
Handinata Kusuma
here is in firefox :
http://debug.datatables.net/umugip
Allan
i think i know what makes the data not render in IE. it because the charset in IE. should UTF-8 not UTF8.
so check the response header
[code]
Content-Type application/json;charset=UTF8
[/code]
it should be :
[code]
Content-Type application/json;charset=UTF-8
[/code]
cause in IE it strictly must UTF-8. :D
Best Regards,
Handinata Kusuma
Allan
because we use struts2 and the struts.properties file we set :
before
[code]
struts.i18n.encoding=UTF8
[/code]
we change to:
after :
[code]
struts.i18n.encoding=UTF-8
[/code]
Case Closed....
Best Regards,
Handinata Kusuma