jqgridsubgrid

jqGrid, only show one subgrid at the time


I'm using jqGrid and I can't have 2 subgrids at the same time, if the second one is clicked, the previous one should be closed.

And I can't find an event to prevent this... I need something like:

$("#list2").jqGrid({
        multiSubGrids: false
});

Maybe It's something I'm missing...

enter image description here

Thanks in advance!


Solution

  • From here Subgrid/Events:

    with subGridRowExpanded: function(subgrid_id, row_id) { ... } you can catch the event.

    and with

    $("#list2 tr:has(.sgexpanded)").each(function () {
        num = $(this).attr('id');
        $(this).collapseSubGridRow(num);
    });
    

    you can collapse all expanded subgridrow.