Create dynamically DataTables 1.9

Create dynamically DataTables 1.9

Adrian2007Adrian2007 Posts: 19Questions: 7Answers: 0
edited May 2017 in Free community support

I would like to know if it's possible to generate/create/initialize dynamically some DataTables, based on the rows of another table. I mean for every row of this table (it is created with DataTables, too and it represents the "header" of the business record) I need to create hidden divs and then when I click on a row of the main table I make an ajax call and then the corresponding div is shown, filled with data returned by the Ajax call (this is the detail or body of the header from the main table).
So I can have more divs shown at the same time, and every div should have its own DataTables.
I hope I explained clear enough.
Thank you,
A

Answers

  • rf1234rf1234 Posts: 2,922Questions: 87Answers: 414

    This should provide some insight:
    https://datatables.net/blog/2016-03-25

    Your hidden divs would be the child tables. Once you select a row in the parent table you can pass values on to the child table. What you would need to add is to dynamically hide and show the respective child tables. And of course how you want to display them.

  • Adrian2007Adrian2007 Posts: 19Questions: 7Answers: 0

    Thankx for the answer. But this works for DataTables 1.9, too?

  • rf1234rf1234 Posts: 2,922Questions: 87Answers: 414

    No idea. Found this:
    DataTables 1.9.4. This software was originally released on 23rd September, 2012.

    The blog post is from 2016. So it might not work.
    @ Allan: Would you know?

  • Adrian2007Adrian2007 Posts: 19Questions: 7Answers: 0
    edited May 2017

    So, in other words, is it possible with DataTables 1.9 to open many divs as "DataTables childtables" (as rf1234 answered) or DataTables main itself (copies of the main DataTable) ?
    I also need to get the data and to paginate the data on every div (all server-side, means every click to a column header to order ASC or DESC or a page number is an Ajax call).
    I'm working on a big project (a java MVC web application) so it's very difficult to update DataTables to a newer version.
    Thank you

This discussion has been closed.