how to put multiple jquery dataTables in one page?

前端 未结 9 1406
迷失自我
迷失自我 2020-12-09 03:22

I want to use jquery dataTables to show something.

It works well when i just put one dataTable in one page, then i add one more, but they occupied almost the same p

9条回答
  •  -上瘾入骨i
    2020-12-09 03:57

    It is possible with server side processing. I have it working in a number of locations in my application. You just need to follow the example code for the server side processing multiple times...

    $(document).ready(function() {
        $('#example').dataTable( {
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "../examples_support/server_processing.php"
        } );
    } );
    

    replacing #example with #id-of-your-table and "sAjaxSource": "../examples_support/server_processing.php" with "sAjaxSource": "url/to/your/server/side/script".

    My guess is that you used the .dataTable selector from the multiple tables example. Which will apply the same setup to all tables with the dataTable class.

提交回复
热议问题