Error with render on column
Error with render on column
Debugger code (debug.datatables.net):
https://debug.datatables.net/erevic
Error messages shown:
DataTables warning: table id=autohausGruppen - Requested unknown parameter 'Autohaus_Gruppen.gemeldet' for row 0, column 2. For more information about this error, please see http://datatables.net/tn/4
Description of problem:
When loading the table the above mentioned error message appears.
When commenting out the "render" part of the code the data is displayed normaly.
Do you guys have any idea where my problem is?
The code inside the render function is runing without a problem, the error appears after the function concluded.
Even the table loads normal.
I tried data: null but the same error appears only for unknown parameter 'null'.
Problematic code:
{
data: "Autohaus_Gruppen.gemeldet",
className: "dt-center",
//defaultContent: '<i class="fa fa-check"/>',
render: function (data,type, row, meta) {
if (data.Autohaus_Gruppen.gemeldet != null && data.Autohaus_Gruppen.gemeldet == 1)
{
return '<i class="fa fa - check"/>';
}
},
orderable: false,
width: "5%"
},
Answers
Nvm. somehow it now works just like this (I'm almost certain I tried this first but oh well sometimes it is what it is):
Using
defaultContent
will work. However the problem is that thecolumns.render
function always needs to return something. You are returning something only if your data == 1. The function should look like this:Kevin