Custom search for non-string value columns
Custom search for non-string value columns
raihaniqbal
Posts: 1Questions: 1Answers: 0
Assuming I have the following dataset:
var myDataSet =
[
{
"SimpleProperty1":"Value1",
"ComplexProperty2":[
{
"SubProperty1":"SubValue1",
"SubProperty2":"SubValue2"
}
]
}
];
Is there a way to specify a custom (override) function for search when I define the columns the same we do for render?
Something like this:
$('#live_table').DataTable({
dom: 'lfrtip',
data: myDataSet,
columns:[
{
title: "Property 1",
data: "SimpleProperty1"
},
{
title: "Property 2",
data: "ComplexProperty2",
render: function(){
// custom render logic
},
search: function(){
// custom search logic to loop through the array
}
}
]
Answers
Hi,
The
columns.render
function will pass in (as the second attribute) information about what kind of data it is requesting. For search data it will pass infilter
which you can check for with anif
and then return the data as you need.More information about this available in the orthogonal data part of the manual.
Allan