Expand detail auto collapse other rows
Closed this issue · 2 comments
ientrytech commented
Is there an easy way to have a detail expanded row auto close when another row is expanded (like an accordion), that way, only one row is expanded at once. For example, if row 5 is already expanded then it will close when you click on another row to open it.
ientrytech commented
Figured out a solution.
this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function () {
var trs = that.$body.find('tr.detail-view');
for (var i = 0; i < trs.length; i++) {
$(trs[i]).prev().find('i').attr('class', sprintf('%s %s', that.options.iconsPrefix, that.options.icons.detailOpen));
trs[i].remove();
}
...
}