title: jQuery - jQGrid - expand,collapse subgrid on grid row click
body: <p><a href="https://stackoverflow.com/questions/3345401">Here</a> there is an answer on how to expand a subgrid when we click a row using:</p>
  
  <pre><code>onSelectRow: function(rowId) {
      $("#jqgrid_id").expandSubGridRow(rowId);
  }
  </code></pre>
  
  <p>How can we collapse the row if it has been already expanded?
  I am looking for something like:</p>
  
  <pre><code>onSelectRow: function(rowId){ 
      if (the_row_of_the_grid is expanded) {
          // collapse: How implement this???
      } else {
          $("#jqgrid_id").expandSubGridRow(rowId);
      }
  }
  </code></pre>
  
  <p>to have a complete expand/collapse on row click.</p>