title: How to programically collapse or expand Kendo Grid Group by values in row
body: <p>I have a requirement to default a grouped grid to collapsed state UNLESS it contains a row with a certain value (Status == "Closed").</p>
  
  <p>I got this far but fell down because the dataView only contains an array of rows of the grouped field not the rows as I've seen before.</p>
  
  <pre><code>  function collapse_rows() {
          var grid = this.grid;
          var dataView = this.dataSource.view();
  
          for (var i = 0; i &lt; dataView.length; i++) {
              if (dataView[i].status == "Closed") {
                  var uid = dataView[i].uid;
                  $("#userQuestionSetGrid tbody").find("tr[data-uid=" + uid + "]").
                  closest("tr.k-grouping-row").each(
                    function (e) {
                        e.collapseRow(this);
                    });
  
              } else {
                  var uid = dataView[i].uid;
                  $("#userQuestionSetGrid tbody").find("tr[data-uid=" + uid + "]").
                  closest("tr.k-grouping-row").each(
                      function (e) {
                          //e.collapseRow(this);
                      });
              }
          }
      }
  </code></pre>