title: jqgrid addRowData gives error t.p.data.push is not a function
body: <p>I am adding data to the grid using a custom button. In case if data already exists in the grid, the new row is added correctly. But if the grid is empty and i add new row, it gives Uncaught TypeError: t.p.data.push is not a function error at jqgrid source file. Code used to add a new row is as below</p>
  
  <pre><code>var rows = $("#" + gridName).getDataIDs();
  $("#" + gridName).jqGrid("addRowData", rows.length + 1, {
  Id: rows.length + 1},'first');
  $("#" + gridName).editRow(rows.length + 1, true);
  </code></pre>
  
  <p>I am using a custom nav bar for adding and editing the grid.</p>
  
  <p>The grid is created using the following code
   createJqGrid:function(gridId, columns, gridData){</p>
  
  <pre><code>        $("#"+gridId).jqGrid({
              datatype: 'local',
              data: gridData,
              editurl: 'clientArray',
              colModel: columns,
              loadonce: false,
              //width: '100%',
              autowidth: true,
              shrinkToFit:false,
              height: 250,
              rownumbers: false,
              multiselect: true,
              cellEdit: true,
              toppager: true,
              cloneToTop: true,
              rowNum: 10000,
              pager: "#pager"+gridId,
              cellsubmit: 'clientArray',
              ondblClickRow: function(rowid, iRow, iCol) {
                  //$("#save" + gridId).removeClass("ui-state-disabled");
              },
              beforeSelectRow: function(rowid, e) {
                  return true;
              },
              beforeCellSelect: function(rowid, e) {
                  return true;
              },
              afterEditCell: function(rowid, cellName, cellValue, iRow, iCol) {
  
                  var cellDOM = this.rows[iRow].cells[iCol];
                  $(cellDOM).removeClass("ui-state-highlight");
                  $("#save" + gridId).removeClass("ui-state-disabled");
  
              },
              onCellSelect: function(rowid, celname, value, iRow, iCol) {
                  //$("#save" + gridId).removeClass("ui-state-disabled");
               return true;
              },
              loadComplete: function() {
  
              }
  
          });
  
  $("#"+gridId).navGrid("#pager"+gridId, {
              cloneToTop: true,
              edit: false,
              search: false,
              add: false,
              del: false,
              refresh: false,
              view: false
          });
  </code></pre>
  
  <p>After the grid is created, based on some calls, I update the gridData for the grid.</p>
  
  <p>Toolbar is added using</p>
  
  <pre><code>        grid.jqGrid('navButtonAdd', '#' + grid[0].id + '_toppager_left', { // "#list_toppager_left"
              caption: "",
              title: "Add",
              id: 'add' + gridName,
              onClickButton: function() {
                  // perform something...
                  var rows = $("#" + gridName).getDataIDs();
                  $("#" + gridName).jqGrid("addRowData", rows.length + 1, {
                      Id: rows.length + 1
                  },'first');
  
                  $("#" + gridName).editRow(rows.length + 1, true);
  
                  // Call this whenever Save button needs to be Enabled
                  $("#save" + gridName).removeClass("ui-state-disabled");
              }
          });
  </code></pre>
  
  <p>when the grid has some data, addRowData works, but when the grid is empty, it gives the error</p>
  
  <pre><code>                if(t.p.datatype === 'local') {
                      lcdata[t.p.localReader.id] = id;
                      t.p._index[id] = t.p.data.length;
                      t.p.data.push(lcdata); // Error comes on this line
                      lcdata = {};
                  }
  </code></pre>