这是我的代码:
$(document).ready(function() {
/* Initialise the DataTable */
var oTable = $('#example').dataTable({
"oLanguage": {
"sSearch": "Search all columns:"
},
"iDisplayLength": 10,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bFilter": true,
});
/* Add a select menu for each TH element in the table footer */
$("thead th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
} );
} );
Run Code Online (Sandbox Code Playgroud)
我使用jquery datatables插件,它的工作方式与此示例完全相同:
http://www.datatables.net/release-datatables/examples/api/multi_filter_select.html
我想要做的是,而不是每列的下拉列表,我只想在一个特定的列上下拉列表.
所以我认为我需要改变:
$("thead th").each( function ( i ) …Run Code Online (Sandbox Code Playgroud)