Single Click performs two operation when used DataTable.ColumnFilter
Single Click performs two operation when used DataTable.ColumnFilter
gangofmumbai
Posts: 2Questions: 0Answers: 0
Hi,
I am using ColumnFilter for filtering the content of table based on Drop down. Through when i click on drop down menu for corresponding Column it get sorted automatically.
Is there any way i can stop the auto sorting when clicked on column header for which Filtering is applied?
Below is sample of my code
[code]
$(document).ready(function(){
var oTable = $('#example').dataTable({
bJQueryUI: true,
//"sPaginationType": "full_numbers",
"iDisplayLength" : -1
});
var items = [];
// getting all the elements from second column
$('#example>tbody>tr>td:nth-child(2)').each( function(){
//add item to array
items.push( $(this).text() );
});
//console.log("items:" + items);
// Finding a unique elements from Second Column
var uniqueSubSystems = $.grep($.unique(items),function(values){
return values != "";
});
//console.log("Unique Items" + uniqueSubSystems);
oTable.columnFilter({ sPlaceHolder: "head: before",
aoColumns: [ null,
{ type: "select", values: uniqueSubSystems },
{ type: "select", values: [ 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] },
null
]
});
});
[/code]
Thanks in advance!!!
I am using ColumnFilter for filtering the content of table based on Drop down. Through when i click on drop down menu for corresponding Column it get sorted automatically.
Is there any way i can stop the auto sorting when clicked on column header for which Filtering is applied?
Below is sample of my code
[code]
$(document).ready(function(){
var oTable = $('#example').dataTable({
bJQueryUI: true,
//"sPaginationType": "full_numbers",
"iDisplayLength" : -1
});
var items = [];
// getting all the elements from second column
$('#example>tbody>tr>td:nth-child(2)').each( function(){
//add item to array
items.push( $(this).text() );
});
//console.log("items:" + items);
// Finding a unique elements from Second Column
var uniqueSubSystems = $.grep($.unique(items),function(values){
return values != "";
});
//console.log("Unique Items" + uniqueSubSystems);
oTable.columnFilter({ sPlaceHolder: "head: before",
aoColumns: [ null,
{ type: "select", values: uniqueSubSystems },
{ type: "select", values: [ 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] },
null
]
});
});
[/code]
Thanks in advance!!!
This discussion has been closed.
Replies
[code]
var oTable = $('#example').dataTable({
bJQueryUI: true,
//"sPaginationType": "full_numbers",
"iDisplayLength" : -1,
bSort: false
});
[/code]