I use the jQuery dataTables plugin to create extended tables for our application. One of the requirements is the presence of "replaceable" lines (not groups!): For example. rows represent campaigns, and they may have child campaigns. The structure of the child rows (in the base case) is the same as in the parent table — the same cells, the same data types.
But the child rows should not affect the parent table: I mean that the number of rows on the page should remain unchanged, the child rows should not be sorted separately from the parent row, they should always remain bound. Therefore, I cannot use the fnAddData () API for this.
And another difficult requirement is the ability to have multi-level discarded rows (for example, child campaigns for child campaigns, etc.)
I used the fnOpen () API function for this , it allows you to "open" any line, attaches a child block to it, and you can insert whatever you want there. It worked fine in dataTables 1.8.2, I used this code to generate child lines:
$(childRowData).each(function(){
row = $(oTable.fnOpen(row.get(0), $(this), "child_row"));
$(row).addClass('child_row');
});
As a rule, he “opened” the current row (defined above), inserted data into the child row, then in the loop “opened” the child row, added a child to it, etc.
But with dataTables 1.9.0 it looks like it is only allowed to “open” the parent rows and do it only once.
, , $. dataTable() , , 3-4 .
dataTables?