server side processing error
server side processing error
Hi to everybody.
I need to use server side processing (I have many thousand of rows) and, in the first cell of the row I linked a child row with the attached file(s). I want to show the + icon to open the row only if there is a file attached to that row (and this work(more or less, see PS note)).
Here is my cell code:
serverSide: true,
columns: [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ' ',
render: function (data) {
//console.log ('data: ',data, "this: ", this, "$(this):", $(this));
if((data.afiles == 'null' )||(data.afiles.length === 0)){
$("#"+data.DT_RowId + ' .details-control').removeClass( 'details-control' );
return;
}
return;
}
},
... other columns...
}]
But, when I search something a popup window error appear:
DataTables warning: table id=diego_table - Unknown field: (index 0)
How can I resolve this?
Thank you!
PS: I have another linked problem: I have an ajax reload button.
buttons: [
{
text: 'Reload',
className: 'reload-button',
action: function ( e, dt, node, config ) {
dt.ajax.reload();
}
When I click on it, the + icon re-appear near all the rows, the render function of the column is not executed again...
This question has an accepted answers - jump to answer
Answers
Change them both to be
return '';
and that should do it. The issue is that you are returningundefined
at the moment, which DataTables doesn't know what to do with (intentionally since it is undefined :-) ).Allan
I tried it... but the error persists!
Can you give me a link to the page in that case - I'll need to debug it.
Hmm - also you can't use
columns.render
to add / remove classes since the cell might not exist at that point. You should userowCallback
in this case I think. Remove yourrender
function entirely and reply withdefaultContent: ''
.Allan
rowCallback
works as a charm:Thank you!
...but the filter error remains!
Can you link to the page so I can debugged why that error is occurring please.
Allan