fnRender getting error when calling function in it.
fnRender getting error when calling function in it.
tomy300
Posts: 16Questions: 2Answers: 0
Hi all
I'm getting an error DataTables warning (table id = 'grid_ententesClients'): Requested unknown parameter '6' from the data source for row 0
[code]
"aoColumns":[
null,null,null,null,null,null,
{ "fnRender": function (oObj) {
//return oObj.aData[0];
return calculatetax(oObj.aData[0]);
}
},null
],
[/code]
I comment the line "return oObj.aData[0];" , I call function I have create calculatetax, if I use my function I getting this error
if I comment the return calculatetax(oObj.aData[0]); function and uncomment //return oObj.aData[0]; the datatable work just fine.
I tought it's was my function but I did an alert in my function of every parameter and I receive all the data correctly, If I do an alert
of each return in my function I also have all the data.
so I wonder what the bug? the fnRender is rendering too fast ???
thanks
I'm getting an error DataTables warning (table id = 'grid_ententesClients'): Requested unknown parameter '6' from the data source for row 0
[code]
"aoColumns":[
null,null,null,null,null,null,
{ "fnRender": function (oObj) {
//return oObj.aData[0];
return calculatetax(oObj.aData[0]);
}
},null
],
[/code]
I comment the line "return oObj.aData[0];" , I call function I have create calculatetax, if I use my function I getting this error
if I comment the return calculatetax(oObj.aData[0]); function and uncomment //return oObj.aData[0]; the datatable work just fine.
I tought it's was my function but I did an alert in my function of every parameter and I receive all the data correctly, If I do an alert
of each return in my function I also have all the data.
so I wonder what the bug? the fnRender is rendering too fast ???
thanks
This discussion has been closed.
Replies
Also I'd suggest you use mRender rather than fnRender. fnRender is removed in DataTables 1.10 (which is in development).
Allan
it's there a way to pause fnrender until the call is finish?
Your Ajax call is asynchronous, so you could use the `async` jQuery call to make it synchronous, but that will absolutely kill performance! You really want to find a way of doing the calculation without making an Ajax call. Ideally have the value in the initial data set.
Allan
I may use this method for this project because it don't treat a lot of data at time, but with a lot of data that may cause problem... I tought about fnInitComplete function I could calculate field after initiation ..so I could store in a array oObj.aData[0] and then change the datatable field in fnInitComplete.... but there another problem if the user use pagination.