Data search for serverside
Data search for serverside
navasfazil
Posts: 1Questions: 1Answers: 0
I have a column named "Tag status" and it returns value from database as 0,1,-1
-1 = In store
0 = Deactivated
1 = Active
How can i search the data by Active,Deactivated or In store.?
I have tried the following code and it appending data-search for each status. But search is not working.
rowCallback: function(row, data, index){
if(data[5] == '-1'){
$('td', row).eq(5).html('<span id="status" data-search="In Store"><span class="label label-sm label-warning">In-Store</span></span>');
}
else if(data[5] == '1'){
$(row).find('td:eq(5)').attr('data-search','Active').html('<span id="status"><span class="label label-sm label-success">Active</span></span>');
}
else if(data[5] == '0'){
$(row).find('td:eq(5)').attr('data-search','Deactivated').html('<span id="status"><span class="label label-sm label-danger">Deactivated</span></span>');
}else
{
$(row).find('td:eq(5)').attr('data-search','Deactivated').html('<span id="status"><span class="label label-sm label-danger">Deactivated</span></span>');
}
if(data[4] == '01-01-1970'){
$(row).find('td:eq(4)').attr('data-search','In-Store').html('<span class="gay" data-search="N/A">N/A</span>');
}
}
Any help?
Thanks
Navas
This discussion has been closed.
Answers
I suspect that if you have
serverSide
processing enabled then using the html5 attributes is not useful. WithserverSide
the server code is expected to perform the search. You would need to convert the terms like "in store" to -1 in your server code then perform the search.Kevin