Custom search for non-string value columns
Custom search for non-string value columns
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
}
}
]
This discussion has been closed.
Answers
Hi,
The
columns.renderfunction will pass in (as the second attribute) information about what kind of data it is requesting. For search data it will pass infilterwhich you can check for with anifand then return the data as you need.More information about this available in the orthogonal data part of the manual.
Allan