Filtering rows in datatable based on button clicks
Filtering rows in datatable based on button clicks
Ramprakash
Posts: 14Questions: 7Answers: 1
I need to filter the rows when i click on a button. The buttons are more and based on the buttons rows also will differ how can i achieve this??
If the button is clicked for first time ajax query to fetch records will be executed after that only row filtering should occur..
Here is my code
var table;
var sortId;
function fetchClients(id){
sortId=id;
$('document').ready(function(){
if(count==1)
{
if(table)
table.destroy();
table=$('#example').dataTable({
"processing":true,
"serverSide":true,
"ajax":{
"url":"/DashBoard/FetchClients",
"dataType":"json",
"data": {alertId: id},
"type":"POST"
},
"aoColumns":[
{"mData": "clientId"},
{"mData":"clientName"},
{"mData": "AliasName"},
{"mData": "Status"},
{"mData": "Time"},
{"mData": "Date"},
{"mData": "AlertId"}
],
"aoColumnDefs": [null,null,null,null,null,null,{ "bVisible": false, "aTargets": [6] }]
});
//table.column(6).visible(false);
//table.columns.adjust().draw( false );
/*$.fn.dataTable.ext.afnFiltering.push(
function( oSettings, mData, dataIndex ) {
var idFrmTable = data[6] ; // use data for the age column
if ( sortId == idFrmTable )
{
return true;
}
return false;
}
);*/
}
else{
}
});
}
This discussion has been closed.