How to render column with function AND set filter?
How to render column with function AND set filter?
mrtomtom
Posts: 7Questions: 4Answers: 0
Hi all,
I'm looking to use a function to return customised display data for a row and also set a separate filter? I can't work out how to it? Anyone see what I'm doing wrong?
columnDefs: [
{
"targets":0,
"render":{
"display":{
function ( data, type, row ) {
return "<a ting #" + name['id'n-xs' href='/thefancylink/" + row['id'] + "' ><i class='fa fa-suitcase'><i/> "+anothervar+row['id']+"</a>";
}
},
"filter": row['id'],
}
}
]
Many thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm using http://datatables.net/reference/option/rowCallback for returning customized display data and
$.fn.dataTable.ext.search.push
for separate filter as shown in this example: http://www.datatables.net/examples/plug-ins/range_filtering.htmlIt should actually be quite possible to do what @mrtomtom is looking for above - as described in the orthogonal data manual and the
columns.render
option - but where I suspect there is a problem is with the staticrow['id']
. What is the variablerow
there? I suspect undefined.What you need to do is provide it as a function like you have for
display
. Also, as noted in the reference documentation, if you givecolumns.render
as an object you must give a_
option.I suspect it will be easier in this case if you just use
columns.render
as a function and have anif
condition on thetype
parameter passed in.Allan