2014-10-10 70 views
0

我有一個網格,我想綁定數據的工作文件,如果記錄的數量少,但對於大型記錄在我的情況下3490它無法綁定數據Kendo無法綁定數據,如果數據非常大

$("#addCustomer_Admin").click(function() { 
    debugger; 
    $.ajax({ 
     url: '@Url.Action("GetAllUnAssignedUnits", "Admin")', 
     dataType: "json", 
     type: "POST", 
     success: function (result) { 
      debugger; 
      BindUnitsGrid(result); 
     }, 
     error: function (result) { 
      debugger; 

     } 
    }); 
}); 

function BindUnitsGrid(data) { 
    debugger; 
    $("#CustomerUnitsGrid").kendoGrid({ 
     dataSource: { 
      data: data, 
      schema: { 
       model: { 
        fields: { 
         UnitID: { type: "number" }, 
         Nickname: { type: "string" }, 
         SerialNumber: { type: "string" }, 
         UnitType: { type: "string" }, 
         Address1: { type: "string" }, 
         City: { type: "string" }, 
         Region: { type: "string" }, 
         PostalCode: { type: "string" } 
        } 
       } 
      }, 
      pageSize: 20, 
     }, 

     sortable: true, 
     filterable: true, 
     columnMenu: true, 
     pageable: true, 
     columns: [ 
      { field: "UnitID", title: "UnitID" }, 
      { field: "Nickname", title: "Nickname" }, 
      { field: "SerialNumber", title: "SerialNumber" }, 
      { field: "UnitType", title: "UnitType" }, 
      { field: "Address1", title: "Address1" }, 
      { field: "City", title: "City" }, 
      { field: "Region", title: "Region" }, 
      { field: "PostalCode", title: "zip", hidden: true } 
     ] 
    }); 
} 

,並在我的控制器:

[HttpPost] 
    public async Task<ActionResult> GetAllUnAssignedUnits() 
    { 
     int UnKnownCutomerID = Convert.ToInt32(ConfigurationManager.AppSettings["UnknownCustomerID"]); 
     if (Session["custUserID"] != null) 
     { 
      try 
      { 
       var list = await _unitRepo.GetUnassignedUnits(UnKnownCutomerID); 
       return Json(list, JsonRequestBehavior.AllowGet); 
      } 
      catch (Exception exe) 
      { 
       Log objLog = new Log(); 
       objLog.LogError(exe.InnerException.ToString()); 
       return RedirectToAction("ShowError", "Error"); 
      } 
     } 
     else 
     { 
      return RedirectToAction("Index", "Account"); 
     } 
    } 

是否有此

回答