Problem with multiple DataTables on same page
Problem with multiple DataTables on same page
Hey there,
following these examples:
http://datatables.net/release-datatables/examples/basic_init/multiple_tables.html
http://datatables.net/release-datatables/examples/api/multi_filter.html
I've build two tables with single column filtering. My problem now is, that the column filter and the TableTools only work for the first table on each page whenever multiple tables appear.
Here's a JSFiddle with example code:
http://jsfiddle.net/vrkS3/
Sorting, etc works for both tables, but filtering and the "save as"-button only work for the first table. I've found several threads dealing with this topic but all were rather old with no satisfying solution, so maybe there came up a solution in the meantime? Concering the column filtering, is my only option using the column-filter plugin?
following these examples:
http://datatables.net/release-datatables/examples/basic_init/multiple_tables.html
http://datatables.net/release-datatables/examples/api/multi_filter.html
I've build two tables with single column filtering. My problem now is, that the column filter and the TableTools only work for the first table on each page whenever multiple tables appear.
Here's a JSFiddle with example code:
http://jsfiddle.net/vrkS3/
Sorting, etc works for both tables, but filtering and the "save as"-button only work for the first table. I've found several threads dealing with this topic but all were rather old with no satisfying solution, so maybe there came up a solution in the meantime? Concering the column filtering, is my only option using the column-filter plugin?
This discussion has been closed.
Replies
Allan
Looking forward to the release version.
Allan
Is there a way to get the individual column filter for multiple tables to work? Currently in every setup only the first table will be able the filter the columns. The jfiddle from above (http://jsfiddle.net/vrkS3/) still shows this issue and is using DataTables1.10.
Thanks in advance :)
> oTable.fnFilter
will limit itself to just a single table based on the $.fn.dataTable.iApiIndex ( http://datatables.net/development/ ). You would need to modify that for each table based on which table is being used. Or split the initialisation into multiple table variables.
With 1.10 it is similar, either use the `table()` API method to reduce the API instance to just the table you want, or split it into multiple parts.
Allan
I am having the same issue, how exactly should we split it into multiple parts? Do we call it in two separate function when initializing in a script tag on the page?
I'm also having the same issue, trying to run four datatables in one page (with million+ rows) and use only column text input search boxes for the first table to search through all the tables, each column separately. Any idea or sample?
If you must use a legacy version of DataTables take a look at this plug-in. But I would suggest using the built in
search()
method in 1.10 to filter multiple tables.Allan
Thanks for your reply Allan, I'm using the latest version of datatable, do you have any sample for that search() method in multiple tables to filter columns?
Allan