首页 > 其他 > 详细

DataTables列过滤器

时间:2015-06-29 20:04:08      阅读:324      评论:0      收藏:0      [点我收藏+]
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>‘) );
    } );

  

DataTables列过滤器

原文:http://www.cnblogs.com/chengshuiqiang/p/4607893.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!