Is it possible to use 4-5 datables on the same page?
Is it possible to use 4-5 datables on the same page?
amitccet
Posts: 10Questions: 2Answers: 0
Currently I am using 2 datatables on the same page and it does work perfectly, sometimes it works and sometimes it does not work. I am not sure what I am doing wrong in that. And also in the future we need to use 4-5 dataTables in the same page. So need to confirm, before leveraging whether it is possible or not ?
This discussion has been closed.
Answers
Yes you can use multiple tables, I use three on single page.
Please post a test case that reflects your problem.
meanwhile,
http://datatables.net/examples/basic_init/multiple_tables.html
for you reference.
Hi reddy23,
I have the same issue. However, if you have the same set of columns, then it works as evidenced in the link you provided. But we have 2 jsps embedded in a jsp. Each child jsp has a table where we utilize search, sort, pagination capabilities with different set of columns and data sources. In this scenario, only 1 table works correctly. However 2 tables are working very rarely. Most of time, the second table fails.
Thanks,
gk2k2
Hi reddy23,
Here are the code snippets from 2 jsp files. In one of the jsps, I am making an Ajax call to get new results and dynamically build the table and then apply datatables.
Please note that page1 works fine as is even after Ajax calls to dynamically build the html table. However page 2 fails. The error message is:
"Type r is undefined"
Thanks
Page1:
Within Ajax call
jQuery("#selectedColumn").change(function() {
............
............
/getting new data thru Ajax call and building in the var, resultsHtml
//building new table
$('#bgrid1Tbody').html("").append(resultsHtml);
-----------------------------------------------------------------------------------------------------------------Second Jsp page
Found the issue, when we add, multiple column filter for multiple tables, otherwise it works fine.
Need to figure out how it works for multiple table with column filter functionality.
If anyone have faced same issue, Please post your inputs.
Thanks in advance.
Can some one please help to solve the issue, it's becoming nightmare for us.
Thanks in advance.
My application utilizes up to 12 Datatables all within either jQuery tabs or dialogs. Some use the same DataTable init as they are either exactly the same or are only a few columns different.
It would help if you could link to an example with the issue you are facing to better help us help you solve your issue.
The tool is extremely powerful and you should definitely use it.
Hi Sir,
I really appreciate all your inputs, as this issue has become nightmare for me.
Description of the Code :- We want two datatables in one page and in both of them their column should be searchable. So we should have column filters in each datatables. And also in future we are planning for 5 datatables in one page, in each of them having there own column filters.
Below is the code with two datables which is not working for me.
Thanks,
Amit Doshi
To add on the above post, it has having issue with column data searching..
Anyone please help me out..
Please link to a test case showing the issue so it can be debugged live.
Allan
Hi Allan,
Thanks for the response.
Here is the link http://jsfiddle.net/bhSv9/50/
Column filter is only working for 1st table, not working for other three tables.
Regards,
Amit Doshi
Hi Allan,
Can you please help me out ?
Thanks,
Amit Doshi
Hi Amit,
Thank you for the link. No need to bump your post just two hours after posting it. I have to take a break sometimes :-). If this is urgent for you, priority support is available.
The problem is with how you are finding the index of the input:
$("tfoot input").index(this)
. That is getting the index of the element out of all the inputs on the page - not just the column index.You need to make the selector more selective. For example:
Allan