Skip to content Skip to sidebar Skip to footer

Cannot Update Value In Kendo-grid - Cannot Read 'data' Property Of Undegined

I am updating Kendo-grid when the selected value in option HTML element is changed. But when I try to update the value in the grid inline in the browser's console is printed 'kendo

Solution 1:

I found the problem. I was removed the id property in my datasource-model of the grid and that caused my problems. I don't know why it is so big deal - especially when I could have objects without ID. But now it is fine.

id: "ProviderWeightsId",
fields: {
  ProviderWeightsId: { editable: false, visible: false, type: "number" },
  ZoneId: { editable: false, visible: false, type: "number" },
  ZoneName: { editable: false, visible: false, type: "string" },
  WeightFrom: { editable: false, visible: true, type: "number" },
  WeightTo: { editable: false, visible: true, type: "number" },   
  Price: { editable: true, visible: true, type: "number" }
}

Solution 2:

You are not passing data to the loadPrices function.

$('#SelectProviderZoneForPrices').change(function (e) {
      var zoneId = $(this).val();
      var productId = $('#SelectProviderForPrices').val();

      $.ajax({
        type: "GET",
        url: "@Html.Raw(Url.Action("LoadZoneWeights", "ShippingZonableByWeight"))",
        success: function (data) {  
            loadPrices(data); //pass data to loadPrices function
        }
        dataType: 'json',
        data: { ProviderId: productId, ZoneId: zoneId }});
    });

Update:

Try this :

public ActionResult LoadZoneWeights(int ProviderId, int ZoneId)
{

  var zoneWeights = _shippingService.GetZonesWithWeights(ProviderId, ZoneId);


  return Json(zoneWeights , JsonRequestBehavior.AllowGet);
}

and

 schema: {
        data: function(response) {
            return response.data;
        }
    }

Post a Comment for "Cannot Update Value In Kendo-grid - Cannot Read 'data' Property Of Undegined"