iDeferLoading with mRender problem
iDeferLoading with mRender problem
DukeNuken
Posts: 7Questions: 2Answers: 0
Hello. I have problem when I use iDeferLoading param with server size model.
My code is http://freemusiclib.com/music/player
[code]
$('#TrackTable').dataTable(
{
"bProcessing": false,
"sAjaxSource": "/Music/ReturnProductTable",
"bServerSide": true,
"bPaginate": true,
"bSort": false,
"iDeferLoading": 1000,
"aoColumns": [
{ "mData": "Rank" },
{ "mData": "Name" },
{ "mData": "Id"},
{ "mData": "Duration" }
],
"iDisplayLength": 50,
/*,"aoColumnDefs": [{ "bSortable": false, "aTargets": ["_all"] }],*/
"aoColumnDefs": [
{
"aTargets": [1],
"mRender": function ( data, type, row ) {
console.log("It is column 1. TrackID = " + row.Id);
console.log(data);
console.log(type);
console.log(row);
return 'some html controls which DOESNT displayed by this forum' + row.Name + 'some html' + row.ArtistName;
},
"sClass": "TrackNameColumn"
},
{
"aTargets": [2],
"mRender": function ( data, type, row ) {
//console.log("It is column 2");
//console.log(data);
//console.log(type);
//console.log(row);
return 'some html controls which DOESNT displayed by this forum';
}
}
]
});
[/code]
The problem is when I use iDeferLoading param I am making first page by server rendering and also I expect what "mRender" will not work for that first page, but in result code of columns generated on server and after that mRender start to generate those html code again. In result i have some mess on page. How to fix it? What "mRender" called for prepared by server side rows?
Looks like it try map server generated row to format
[code]
"aoColumns": [
{ "mData": "Rank" },
{ "mData": "Name" },
{ "mData": "Id"},
{ "mData": "Duration" }
],
[/code]
but how to add more data to that? I mean when I call server side by "/Music/ReturnProductTable" link it return like 10 params which avalable in "mRender" function by "row" param ( for example row.ArtistName), but when code use server side generated rows it have only those 4 columns in "row" param and row.ArtistName is undefined.
PS> For some reason on that forum page It doesnt display html code which return by mRender but just show ' '.
My code is http://freemusiclib.com/music/player
[code]
$('#TrackTable').dataTable(
{
"bProcessing": false,
"sAjaxSource": "/Music/ReturnProductTable",
"bServerSide": true,
"bPaginate": true,
"bSort": false,
"iDeferLoading": 1000,
"aoColumns": [
{ "mData": "Rank" },
{ "mData": "Name" },
{ "mData": "Id"},
{ "mData": "Duration" }
],
"iDisplayLength": 50,
/*,"aoColumnDefs": [{ "bSortable": false, "aTargets": ["_all"] }],*/
"aoColumnDefs": [
{
"aTargets": [1],
"mRender": function ( data, type, row ) {
console.log("It is column 1. TrackID = " + row.Id);
console.log(data);
console.log(type);
console.log(row);
return 'some html controls which DOESNT displayed by this forum' + row.Name + 'some html' + row.ArtistName;
},
"sClass": "TrackNameColumn"
},
{
"aTargets": [2],
"mRender": function ( data, type, row ) {
//console.log("It is column 2");
//console.log(data);
//console.log(type);
//console.log(row);
return 'some html controls which DOESNT displayed by this forum';
}
}
]
});
[/code]
The problem is when I use iDeferLoading param I am making first page by server rendering and also I expect what "mRender" will not work for that first page, but in result code of columns generated on server and after that mRender start to generate those html code again. In result i have some mess on page. How to fix it? What "mRender" called for prepared by server side rows?
Looks like it try map server generated row to format
[code]
"aoColumns": [
{ "mData": "Rank" },
{ "mData": "Name" },
{ "mData": "Id"},
{ "mData": "Duration" }
],
[/code]
but how to add more data to that? I mean when I call server side by "/Music/ReturnProductTable" link it return like 10 params which avalable in "mRender" function by "row" param ( for example row.ArtistName), but when code use server side generated rows it have only those 4 columns in "row" param and row.ArtistName is undefined.
PS> For some reason on that forum page It doesnt display html code which return by mRender but just show ' '.
This discussion has been closed.
Replies
Allan
Allan