Collapse / Expand Click Groups - Page 2

Collapse / Expand Click Groups

2»

Replies

  • kthorngrenkthorngren Posts: 13,786Questions: 25Answers: 3,242

    In order to start with the groups collapsed you need to move the lines I suggested above into initComplete. Otherwise it executes before the ajax response as ajax is an asynchronous process.

    More importantly you found an old example to work with. Originally the RowGroup extension used the class group-start but that changed at some point. The classname now is dtrg-group. Here is the updated example:
    http://live.datatables.net/ruhuguwu/15/edit

    Kevin

  • colincolin Posts: 12,608Questions: 0Answers: 2,154

    It looks like the classes have changed for RowGroup - you need tr.dtrg-start now, see here: http://live.datatables.net/ruhuguwu/17/edit

    Colin

  • SchnitzerSchnitzer Posts: 6Questions: 0Answers: 0

    Awesome, thanks @kthorngren and @colin. Had no idea about the class changing.

    One last thing, I added salarySum on the aggregate row: http://live.datatables.net/ruhuguwu/20/edit.

    I wanted the aggregate row to display the 'Extn' value from the child row as well. How do we display:
    1) The 'Extn' value from the only the first child row?
    2) A Comma separated list of all 'Extn' values in the child rows

  • kthorngrenkthorngren Posts: 13,786Questions: 25Answers: 3,242

    The rowGroup.startRender function has three parameters with the first being the array of rows in the group.

    1) The 'Extn' value from the only the first child row?

    You can use rows[0] to get the first row.

    2) A Comma separated list of all 'Extn' values in the child rows

    You can use rows().every() to loop through all the rows in the group. This is a long ]example](https://jsfiddle.net/t36on5mv/) but you can see the rows().every() loop in the rowGroup.startRender function. The example is from this thread. This is the specific code:

                     rows.every(function ( rowIdx, tableLoop, rowLoop ) {
                        var data = this.data();
                        console.log(data)
                        // ... do something with data(), or this.node(), etc
                      });
    

    rows in rows.every(....); is the rows function parameter.

    Kevin

Sign In or Register to comment.