jQuery DataTables sDom order not work

2019-03-05 23:07发布

I need the "filter" in the upper left side and the "size" in the upper right side, but is not working:

$(document).ready(function() {
    jQuery('#example').dataTable({
            "sDom": '<"top"fl>rt<"bottom"ip><"clear">'
        });
} );

Why?

1条回答
霸刀☆藐视天下
2楼-- · 2019-03-05 23:32

SOLUTION

  • Use these two CSS rules to target all data tables:

    .dataTables_wrapper .dataTables_filter {
      float: left;
    }
    
    .dataTables_wrapper .dataTables_length {
      float: right;
    }
    
  • Use these two CSS rules to target #example data table:

    #example_wrapper .dataTables_filter {
      float: left;
    }
    
    #example_wrapper .dataTables_length {
      float: right;
    }
    

DEMO

See this jsFiddle for code and demonstration.

查看更多
登录 后发表回答