您的位置:首页 > 其它

DataTables列过滤器

2015-06-29 17:01 190 查看
var table = $('#example').DataTable();

table.columns().flatten().each( function ( colIdx ) {
// Create the select list and search operation
var select = $('<select />')
.appendTo(
table.column(colIdx).footer()
)
.on( 'change', function () {
table
.column( colIdx )
.search( $(this).val() )
.draw();
} );

// Get the search data for the first column and add to the select list
table
.column( colIdx )
.cache( 'search' )
.sort()
.unique()
.each( function ( d ) {
select.append( $('<option value="'+d+'">'+d+'</option>') );
} );


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: