Expanding jqgrid subgrid

后端 未结 2 583
萌比男神i
萌比男神i 2021-02-09 08:18

I have a jqgrid that has a subgrid. How can I expand the subgrid without having to click on the plus sign?

I came across $(\"#jqgrid_id\").expandSubGridRow(rowId);

相关标签:
2条回答
  • 2021-02-09 09:02

    Use $("#jqgrid_id").expandSubGridRow(rowId); in the onSelectRow Event of the grid.

    Something like this:

    jQuery("#jqgrid_id").jqGrid({
    ...
       onSelectRow: function(rowId){ 
          $("#jqgrid_id").expandSubGridRow(rowId); 
       },
    ...
    });
    

    EDITED: on GridComplete event

    jQuery("#jqgrid_id").jqGrid({
    ...
       gridComplete: function(){ 
          var rowIds = $("#jqgrid_id").getDataIDs();
          $.each(rowIds, function (index, rowId) {
            $("#jqgrid_id").expandSubGridRow(rowId); 
          });
       },
    ...
    });
    
    0 讨论(0)
  • 2021-02-09 09:11

    Change getDataIds() to getDataIDs()!

    0 讨论(0)
提交回复
热议问题