views:

359

answers:

4

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 position, and one of them doesn't work well.

Do you know how to deal with that?

A: 

Too lazy to google? .) There you go: http://www.datatables.net/examples/basic_init/multiple_tables.html

Eimantas
I'm so sorry, i neglect the docs there. But thank you. :)
garcon1986
It doesn't work with server side data.
garcon1986
A: 

The examples show static data, not from server. I think it can't be used in my case. Thanks.

garcon1986
+1  A: 

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.

Jack Ryan
A: 

"Too Lazy to Google" now that's funny!!!

Patrick