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>') );
    } );

  

相关文章:

  • 2022-12-23
  • 2021-10-04
  • 2021-05-31
  • 2021-07-27
  • 2021-10-23
  • 2022-12-23
  • 2021-08-15
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2021-06-12
  • 2021-12-23
  • 2022-12-23
  • 2022-02-23
  • 2021-07-11
  • 2021-08-26
相关资源
相似解决方案