title: Populate Kendo grid with Ajax result
body: <p>I want to be able to use the result of the ajax call to make a decision which Kendo Grid I will populate.  If I receive only one item in the array I want to populate a grid, otherwise I have another grid for multiple items.</p>
  
  <p><strong>My jQuery</strong></p>
  
  <pre><code>    $.ajax({
          type: "POST",
          dataType: "json",
          url: 'Item/GetItems/',
          data: { number: number },
          success: function (data) {
  
              if (data.length == 1) {
                  var sGrid = $("#SingleGrid").data("kendoGrid").dataSource.data(data);
  
                  //I´ve also tried this
                  //sGrid.refresh();
              }
              else {
                  var mGrid = $("#MultipleGrid").data("kendoGrid").dataSource.data(data);
  
                  //I´ve also tried this
                  //mGrid .refresh();
              }
          },
          error: function () {
          }
      });
  </code></pre>
  
  <p><strong>My Controller Action</strong></p>
  
  <pre><code>    public ActionResult GetItems([DataSourceRequest] DataSourceRequest request, string number)
      {
          var items = _idg.GetItems(number);
          return Json(items.ToDataSourceResult(request, ModelState));
      }
  </code></pre>
  
  <p>I´ve been monitoring Firebug and it shows no errors.  I´m trying to prevent the second call to the server by making the decision to populate one of the grids.  Is there a way force dataSource refresh like this client-side?  (without calling the read function on the dataSource which would call the server the second time)</p>
  
  <p><strong>###### EDITED ########</strong></p>
  
  <pre><code>function TestGrid() {
      var dataSource = new kendo.data.DataSource({
          transport: {
              read: {
                  type: "POST",
                  dataType: "json",
                  url: 'Item/GetItems/'
              }
          },
          schema: {
              data: function (response) {
                  // Here the Total is always correct
                  return response.Total;
              }
          }
      });
  
      dataSource.fetch(function () {
          var kendoGrid;
          var data = this.data();
          //Here the data does not include my Total
          alert(data);
          if (data.length == 1) {
              kendoGrid = $("#SingleGrid").data("kendoGrid");
          } else {
              kendoGrid = $("#MultipleGrid").data("kendoGrid");
          }
          kendoGrid.setDataSource(dataSource);
          kendoGrid.refresh();
      });
  }
  </code></pre>
  
  <p>From my example above I can´t seem to reach the total number from this.data().  When I debug with Firebug I can see that the Total number is always correct.  Any ideas?</p>