Is it possible to display a different table after clicking a primary table cell?

Is it possible to display a different table after clicking a primary table cell?

rdmrdm Posts: 194Questions: 55Answers: 4

This DataTables example (sliding child rows) got me thinking. It possible to do something similar -- but rather than showing a "card", I can show a different table?

Using an example we can all relate to, suppose I have table of car manufacturer, make, and model. Let's say I click on a specific "model" cell (e.g., Civic), immediately beneath we see a short table showing (for example) a sales table of years and new/used status. So it's not a "card" but an actual table.

Can DataTables do something like this? I've been searching Google for jquery-based tables that can do something similar, but the link I started this question with is the closest thing I've found.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Checkout this blog which uses a second table for the child data. If you aren't using Editor you can ignore those parts of the blog.

    Kevin

  • rdmrdm Posts: 194Questions: 55Answers: 4

    Not quite what I was hoping for. The second table is separate from the first table, whereas I was hoping to insert a table within the first table, after the row of the selected cell.

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    Answer ✓

    Something like this blog? Same comment about the editor parts.

    Kevin

  • rdmrdm Posts: 194Questions: 55Answers: 4

    I'm noticing a lag as the inner table gets rendered. Since I'm doing DataTables only, I'll have to test that out and see whether there isn't much of a lag.

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    The lag in the blog is due to the child datatable fetching the row data via Ajax. See the config here. You don't need to fetch the data if its already part of the row data, like this example:
    http://live.datatables.net/gohefoki/1/edit

    Kevin

Sign In or Register to comment.