$("#dataTableId").dataTable().columnFilter();
var oTable = $('#table1').dataTable({
"bFilter": false,
"sScrollY": "400px",
"bPaginate": false,
"bInfo" : false
} );
new FixedHeader( oTable, { "bottom": true } );
oTable.columnFilter({aoColumns: [ null,{ type: "text"},{ type: "select", values: [ 'Power on Server'] },
{ type: "select", values: [ 'Complete','Failed','Incomplete'] },
{ type: "text"},{ type: "text" },{ type: "text" }
]
});
var oTable = $('#table1').dataTable({
"bFilter": false,
"bInfo" : false
} ).columnFilter({aoColumns: [ null,{ type: "text"},{ type: "select", values: [ 'All Tasks','Power on Server'] },
{ type: "select", values: [ 'All Status','Complete','Failed','Incomplete'] },
{ type: "text"},{ type: "text"},{ type: "text"}
]
});
new FixedHeader( oTable, { "bottom": true } );
var oTable = $('#table1').dataTable({"sDom": '<"top"i>rt<"bottom"lp><"clear">'
,"bInfo": false,"bPaginate": false,"bAutoWidth": false,"sScrollY":"400px"
}).columnFilter({aoColumns: [ null,{ type: "text"},{ type: "select", values: [ 'All Tasks','Power on Server'] },
{ type: "select", values: [ 'All Status','Complete','Failed','Incomplete'] },
{ type: "text"},{ type: "text"},{ type: "text"}
]
});
new FixedHeader( oTable, { "bottom": true } );
$("table").each( function () {
$(this).dataTable().columnFilter();
} );
function config_data(id){
var oTable;
oTable = $('#'+id).dataTable( {
"oLanguage": {
"sSearch": "Search all columns:"
},
"sDom": 'RfClrtip',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": fields,
"bAutoWidth": false,
"bInfo": true
oTable.columnFilter({
aoColumns: fieldsfilter //fieldsfilter is an earlier defined array of column filter options for each column
})
} );
}
function config_data(id){
var oTable = $('#'+id).dataTable( {
"oLanguage": {
"sSearch": "Search all columns:"
},
"sDom": 'RfClrtip',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": fields,
"bAutoWidth": false,
"bInfo": true
} );
oTable.columnFilter({
aoColumns: fieldsfilter //fieldsfilter is an earlier defined array of column filter options for each column
});
}
<div id="renderingEngineFilter" class="filterOption"></div> <div id="browserFilter" class="filterOption"></div> <div id="platformsFilter" class="filterOption"></div> <div id="engineVersionFilter" class="filterOption range"></div> <div id="cssGradeFilter" class="filterOption"></div> <div id="customFilter"></div> <!-- this one -->
$(document).ready( function () {
$('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
})
.columnFilter({aoColumns:[
{ type:"select", sSelector: "#renderingEngineFilter" },
{ sSelector: "#browserFilter" },
{ sSelector: "#platformsFilter" },
{ type:"number-range", sSelector: "#engineVersionFilter" },
{ type:"select", values : ["A", "B", "C", "X"], sSelector: "#cssGradeFilter" },
{ type:"select", values : ["vannkorn", "ravy", "rayuth"], sSelector: "#customFilter"} //here is where I add it
]}
);
} );
Ameena said:
I tried with following initialization but it doesn't work. Please help me
$.fn.columnFilter = function (options) {
oTable = this;
var TableWrapper= $('#'+oTable.attr('id') + '_wrapper');
var sFilterRow = 'tfoot tr';
var sFilterRow = '.dataTables_scrollFoot tfoot tr';
$(sFilterRow + " th", oTable).each(function (index) {
$(sFilterRow + ' th', TableWrapper).each(function (index) {
ChrissyC said: I have looked and looked, please help! I need to be able to set a class for the columnfilters individually. My first column filter needs to be 100px, my second 200px; etc. I see comments to use css, but nothing about how to add the class to each filter?
function fnCreateInput(regex, smart, bIsNumber) {
var sCSSClass = "text_filter";
if (bIsNumber)
sCSSClass = "number_filter";
var input = $('<input type="text" class="search_init ' + sCSSClass + '" value="' + label + '"/>');
function fnCreateInput(regex, smart, bIsNumber) {
var sCSSClass = "text_filter";
if (bIsNumber)
sCSSClass = "number_filter";
var input = $('<input type="text" class="search_init ' + sCSSClass + '" value="' + label + ' style="width:100px" />');
$('#EobTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "ListHandler.ashx",
"sServerMethod": "POST",
"fnServerData": function (sSource, aoData, fnCallback, oSettings) {
oSettings.jqXHR = $.ajax({
"dataType": 'json',
"type": 'POST',
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
}).columnFilter({
sPlaceHolder: "head:before",
aoColumns: [null, null, null, null, null, { type: "date-range", sRangeFormat: "Between {from} and {to} dates" }]
});
sPlaceHolder: "head:before"
sPlaceHolder: "head:after"
})
.columnFilter({
aoColumns: [
{type: "text"},
{type: "date-range"}, // I want to set this lower value to current date !
{type: "select"}
]
});
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.