columns.render does not work
columns.render does not work
Hello,
I am using Datatables with server side precessing. My goal is to have a column which uses several properties of my data source to assemble each cell html. At first I though of setting the option columns.render to a function, and columns.data to null, in accordance to their specifications.
However, regardless of the value I pass to columns.data, it doesn't seem to work, and I get that warning saying that the parameter is unknown. Odd enough, if I set columns.defaultContent, the warning goes away, but I get stuck with a fixed value for all the column's cells.
I was able to reproduce this issue in a plunkr
https://plnkr.co/edit/XJeuxNe8rlLFQwyHXJYu?p=preview
Could it be that the documentation is outdated and I am passing an invalid combination of options?
It would be great to find out what the problem is.
This question has an accepted answers - jump to answer
Answers
Made a few changes here:
https://plnkr.co/edit/UiCoiub22t9CepXwTJ4X
Changed from using
columnDefstocolumnssimply because you are configuring each column individually andcolumnstakes precedence overcolumnDefs. Also note I removed thetargetsoption as that is not used withcolumns. However you can stick with your columnDefs and it will still work with the following two changes.In your last column I made the following changes:
"data": null,and addeddefaultContent: '',returnstatement. Apparently Javascript does not recognize the string if it starts on the next line.Kevin