Working example of Parent/Child rows?

Working example of Parent/Child rows?

dbloordbloor Posts: 12Questions: 3Answers: 2

Hi all,

I'm still new to Datatables as well as PHP Web / Javascript coding in general. I was looking at this page https://datatables.net/reference/api/row%28%29.child%28%29 and I'm having a bit of trouble wrapping my head around it.

Does anyone know of a working example of this somewhere? I'd like to see how it works. My idea is to have Parent row for Brand and then a contact row for each child. Some Brands have 1 contact while some have up to 3. I'd like a new contact row (child) for each Brand row (Parent).

Do you think this would work?
Thanks!

This question has accepted answers - jump to:

Answers

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394
    Answer ✓
  • dbloordbloor Posts: 12Questions: 3Answers: 2
    edited May 2015

    Thanks tangerine :) I was just writing the following reply when I got called away form my desk.

    Okay so I started answering my own question. I found this blog: http://datatables.net/blog/2014-10-02 which has nice sliders.
    Then I found this in API references: http://datatables.net/examples/api/row_details.html which I saw before, but wasn't sure if it would work...

    So now I just need to under stand the +d.name. I'm pulling my data dynamically from a MySQL server and the data is also from a separate table I use a joining reference table as well. going to fiddle and then come back if I have questions.

  • dbloordbloor Posts: 12Questions: 3Answers: 2

    Okay so I am close. I have the row apearing, but there is no plus (+) icon appearing. Also, can someone just let me know, am I supposed to change the 'd' to something in my data call? or is d actually meant to be left in there?

    Thanks!

  • dbloordbloor Posts: 12Questions: 3Answers: 2
    Answer ✓

    Okay I got it... I had missed placing my table inside the var of "table".

    I had copy+pasted the "var = table...." below my actual table... anyway, my code was a mess, but it's making sense now!

    Thanks!

This discussion has been closed.