Expand one row's details and collapse all others
Expand one row's details and collapse all others
I'm using the example code from http://datatables.net/release-datatables/examples/api/row_details.html to expand/collapse row details, but would like to tweak it to collapse any already open details when a new row is clicked, so that only one row's details are ever shown at a time. Without recursing through the entire table, is there an efficient way of doing this? I was thinking of storing the expanded row's ID in a variable, and just toggling the row when a new row is clicked and updating the variable with the new row's ID, but I haven't had enough coffee yet this morning to figure out how to make this work. You can see a working example at http://www.modeltraintracker.com/sandbox/ (login: testuser , password: testuser ).
This discussion has been closed.
Replies
1. The expand/collapse image on the old row is not updated, and
2. The old row cannot be expanded again...
I am looking for data table config, to expand only one row at a time.
How did you achieve this?
Would you mind sharing the sample code to me.
Thanks in advance.
Can you tell me how to do that.
It worked by using an array to store nTr node and then before a row span, i close all node in array