iDeferLoading with mRender problem

iDeferLoading with mRender problem

DukeNukenDukeNuken Posts: 7Questions: 2Answers: 0
edited December 2013 in DataTables 1.9
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 ' '.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Thanks for flagging this up. I'm not immediately sure why this is happening. I'll need to look into it a bit, but it will likely be the new year before I can. I've bookmarked the discussion to remind myself to look at it then.

    Allan
  • DukeNukenDukeNuken Posts: 7Questions: 2Answers: 0
    Hey Allan. Any updates on this?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Sorry - not had a chance yet. Overwhelmed with everything that I need to do. Will try to get to it as soon as possible.

    Allan
This discussion has been closed.