数据表& Bootstrap分页

时间:2016-09-01 12:56:56

标签: twitter-bootstrap datatables

我正在使用数据表& JSP页面中的Bootstrap

https://datatables.net/manual/styling/bootstrap-simple.html

我想在选择器中添加 onchange 功能 显示N个条目

这可能吗???????????

这是我的JSP中的代码:

  <script>
            $(document).ready(function(){
                $('[data-toggle="tooltip"]').tooltip();
                var table = $('#deviceTableId').DataTable({
                    "dom": '<"top">rt<"bottom"lp><"clear">',
                    "autoWidth": false,
                    "columnDefs": [
                        {"targets": 'nosort', "orderable": false, "width": '30%'},
                        {"targets": [0], "width": '20%'},
                        {"targets": [1], "width": '35%'},
                        {"targets": [2], "width": '15%'},
                    ]
                });
                table.columns().every( function () {
                    var that = this;
                    $( 'input', this.header() ).on( 'keyup change', function () {
                        if ( that.search() !== this.value ) {
                            that
                                .search( this.value )
                                .draw();
                        }
                    } );
                } );
            });

        </script

&GT;

1 个答案:

答案 0 :(得分:1)

使用此代码获取更改事件。

{{1}}

请参阅此Fiddle