columnDefs.data
columnDefs.data
ThomD
Posts: 334Questions: 11Answers: 43
I'm working on a column that is a calculated value, using the columnDef.data option. When I had the column defined like this:
{ data: null, title:"Outlier" }
my columnsDef was ignored. I had to change the column declaration to this
{ title:"Outlier" } ,
to get it to work. Is that expected?
Also, is there a difference between using columnDefs.data()
columnDefs: [
{ targets: [ -6 ], data: function (row, type, val, meta) {
do some crazy business logic
return myresult;
}
]
and doing the same thing (with a function) in the columns.data option?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Your first two code lines above have no "target". A columnDefs definition requires a target.
Sorry, the first two lines are from the columns option of the initial dataTable load.
We'd really need a link to a test page showing the issue please.
Allan
This isn't an issue per se because I found a way to make it work (Don't declare 'data' in two palces), it's an observation.
Since you can define the data for a column in either the columns option of the dataTables() call or in the columnsDef() area, does it matter where this is done?
You can do either, and it can actually be useful to do both, but the value defined in the
columns
array will always "win". There can be only one value in the end (to paraphrase an old film :-) ).Allan