Hey there!
i'm not sure if somebody has already asked this one, but i could not find anything after searching in google for a couple of hours and in this forum.
I have this strange issue with Datatables. My situation is:
-) It's a Single Site Application
-) Multiple Tables on different div's, which i hide and show with the style-setting "display:none"
-) Every table initializes, when it's needed (e.g. user clicks on a link in the navigation)
-) One Table has about 2500 Rows, the other ones (about 5-6 Tables) have 10 Rows
The Plugin works really nice when i have only those small Tables initiated, but once i load/initialize the 'big' table, every other table also takes about 1-2 seconds to initialize, which does not happen, when i haven't loaded the 'big' table. The small tables usually initiate 'instantly', when the big one isnt initiated.
My code for the initialization of the big table is:
{ "bProcessing": true,
"bPaginate": true,
"aoColumns": [
{ "bSearchable": false, "bVisible": false, "mData": "ROWNUM" },
{ "mData": "ID", "mRender": addButtonsListeEA },
{ "sType": "date-eu", "mData": "DATE_RETRIEVED" },
{ "mData": "DESCR" },
{ "mData": "BW", "sType": "formatted-num", "sClass": "alignRight" },
{ "mData": "BW_F", "sType": "formatted-num", "sClass": "alignRight" },
{ "mData": "PRICE", "sType": "formatted-num", "sClass": "alignRight" },
{ "mData": "KAT_NAME" }
],
"bSortClasses": false,
"aoColumnDefs": [{
"aTargets": [4, 6], "fnCreatedCell": setColor
}],
"aaSorting": [[0, "asc"]],
"sAjaxSource": "Default.aspx/loadList",
"sAjaxDataProp": "Rows",
"bDeferRender": true,
"fnServerData": getJSONFromDB
}
For the other tables it is without sAjaxsource, only something like this:
{ "aoColumns": [
{ "bSearchable": false, "bVisible": false },
null,
null,
null,
{ "sType": "date-eu" }
],
"aaSorting": [[0, "asc"]]
}
my getJSONFromDB-function:
function getJSONFromDB(sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"type": "POST",
"data": aoData,
"success": function (ret) {
var json = JSON.parse(ret.d);
fnCallback(json);
}
});
}
DataTables perfectly fits my needs, except for that lag in the initialization-part.
Everything works fine, once the table is initialized, but for my application i cant accept the time it takes, to init the tables, once a big table has been loaded.
Do you have any Idea why that happens and could give me some tips?
Thanks!
i'm not sure if somebody has already asked this one, but i could not find anything after searching in google for a couple of hours and in this forum.
I have this strange issue with Datatables. My situation is:
-) It's a Single Site Application
-) Multiple Tables on different div's, which i hide and show with the style-setting "display:none"
-) Every table initializes, when it's needed (e.g. user clicks on a link in the navigation)
-) One Table has about 2500 Rows, the other ones (about 5-6 Tables) have 10 Rows
The Plugin works really nice when i have only those small Tables initiated, but once i load/initialize the 'big' table, every other table also takes about 1-2 seconds to initialize, which does not happen, when i haven't loaded the 'big' table. The small tables usually initiate 'instantly', when the big one isnt initiated.
My code for the initialization of the big table is:
{ "bProcessing": true,
"bPaginate": true,
"aoColumns": [
{ "bSearchable": false, "bVisible": false, "mData": "ROWNUM" },
{ "mData": "ID", "mRender": addButtonsListeEA },
{ "sType": "date-eu", "mData": "DATE_RETRIEVED" },
{ "mData": "DESCR" },
{ "mData": "BW", "sType": "formatted-num", "sClass": "alignRight" },
{ "mData": "BW_F", "sType": "formatted-num", "sClass": "alignRight" },
{ "mData": "PRICE", "sType": "formatted-num", "sClass": "alignRight" },
{ "mData": "KAT_NAME" }
],
"bSortClasses": false,
"aoColumnDefs": [{
"aTargets": [4, 6], "fnCreatedCell": setColor
}],
"aaSorting": [[0, "asc"]],
"sAjaxSource": "Default.aspx/loadList",
"sAjaxDataProp": "Rows",
"bDeferRender": true,
"fnServerData": getJSONFromDB
}
For the other tables it is without sAjaxsource, only something like this:
{ "aoColumns": [
{ "bSearchable": false, "bVisible": false },
null,
null,
null,
{ "sType": "date-eu" }
],
"aaSorting": [[0, "asc"]]
}
my getJSONFromDB-function:
function getJSONFromDB(sSource, aoData, fnCallback) {
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"type": "POST",
"data": aoData,
"success": function (ret) {
var json = JSON.parse(ret.d);
fnCallback(json);
}
});
}
DataTables perfectly fits my needs, except for that lag in the initialization-part.
Everything works fine, once the table is initialized, but for my application i cant accept the time it takes, to init the tables, once a big table has been loaded.
Do you have any Idea why that happens and could give me some tips?
Thanks!