Requested unknown parameter
Requested unknown parameter
Hi,
I try to custom the display of a cell of my datatable:
"render": function ( data, type, row ) {
number_posts = parseInt(data);
if(data > 0)
return row[7];
},
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
If the data is
0then your function is returningundefined(since there is no explicit return statement for that case), which would result in the issue you are seeing. You need to return something.Allan
Sorry, I press Enter but the post is not complete./
Here my JSON file:
That's working fine, but I get an alert error when I load the table:
"DataTables warning: table id=data_index - Requested unknown parameter '7' for row 0, column 7"
Do you have any idea what's wrong?
As Allan said if your data value is 0 you aren't returning anything. You need to return a value otherwise its undefined and an error.
Kevin
OK. I've tried with this JSON:
I've change 0 to "nolink"...and after....
That's change anything. The values are correctly display (or not) but I get the same alert error when I load the table.
Do you have any idea ?
In your render function you are potentially not returning anything.
You have this:
But you should have this:
You can return the original data like I show above or something else. Your function needs to return something or you will get the unknown parameter error.
Kevin
Thank's a lot, that's works perfectly