Question regarding the Row API

Question regarding the Row API

xdamianvxxdamianvx Posts: 1Questions: 1Answers: 0

I'm trying to utilize the Row Api to create a 'nested table' structure. I've already looked at the documentation on the web site. I'm using a 'javascript' backed data object to populate the data table, not ajax. (i.e. data attribute in the options as well as columns defined)

I can get to the point where i click on parent row 1 and add 3 child rows underneath it. The javascript backing object for that particular row has 'children' elements that i can use to create the rows. The problem comes with trying to get to the next tier underneath that. When i click on a parent row i can utilize row.data().children. However, when i click on the newly created first level children rows, there's no way to reference row.data() and get any form of backing object on that row, since it's just created via html appending it seems.

Is there a way to create a row to add as children and set some form of backing object to it so when i click on it i can access its children if they had them too?

row 1
row 1.1 (created through child api)
row 1.2 (created through child api)
row 1.3 (created through child api)

Thanks in advance,
Damian

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,771Questions: 1Answers: 10,112 Site admin
    Answer ✓

    since it's just created via html appending it seems.

    Correct - the child rows are not part of the DataTable. They have no relation at all other than that they are a host of the parent row. There is no way to use the rows() API with the child rows.

    If you wanted ot be able to access the rows using the rows() API they would need to be added to the table using rows.add() / row.add().

    Allan

This discussion has been closed.