Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expanding jqgrid subgrid

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); but am unsure which rowId to use to expand the subgrid.

Thanks.

like image 555
Trevor Avatar asked Jul 27 '10 15:07

Trevor


2 Answers

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); 
      });
   },
...
});
like image 127
John Hartsock Avatar answered Nov 01 '22 20:11

John Hartsock


Change getDataIds() to getDataIDs()!

like image 45
Stefan Avatar answered Nov 01 '22 18:11

Stefan