2017-03-09 70 views
1

我遇到使用Kendo UI網格的問題,每當我點擊添加新按鈕時,它總是會產生此腳本錯誤。 enter image description here未被捕獲的類型錯誤:e(...)。父母(...)。和自我在Kendo UI網格

這是我使用的代碼:

dataSource = new kendo.data.DataSource({ 
    batch: true, 
    pageSize: 20, 
    transport: { 
     read: { 
      url: 'SaladEntry/GetSupport2/', 
      dataType: "json" 
     }, 
     destroy: { 
      url: 'SaladEntry/DeleteSupportKendo2/', 
      type: "POST", 
      contentType: 'application/json' 
     }, 
     create: { 
      url: 'SaladEntry/SaveSupportKendo2/', 
      type: "POST", 
      contentType: 'application/json', 
      complete: function (e) { 
       SupportGrid(); 
      } 
     }, 
     update: { 
      url: 'SaladEntry/EditSupportKendo2/', 
      type: "POST", 
      contentType: 'application/json', 
      complete: function (e) { 
       SupportGrid(); 
      } 
     }, 
     parameterMap: function (options, operation) { 
      if (operation == "read") { 
       return saladparamObj; 
      } 
      else { 
       options.models[0].CountryNo = $('#Country_No').val(); 
       var SaladParamSerialized = JSON.stringify(options.models); 

       return SaladParamSerialized; 
      } 
     } 
    }, 
    schema: { 
     model: { 
      id: "PK", 
      fields: { 
       CountryNo: { editable: true, nullable: true }, 
       EffectiveDate: { type: "date" }, 
       stringEffectiveDate: { type: "string" }, 
       ScaleMin: { validation: { required: true } }, 
       ScaleMax: { validation: { required: true } }, 
       Currency: { type: "string" } 
      } 
     } 
    }, 

    sort: { 
     field: "stringEffectiveDate", 
     dir: "desc", 
     compare: function (a, b, dir) { 
      return kendo.parseDate(a.EffectiveDate) - kendo.parseDate(b.EffectiveDate); 
     } 
    } 
}); 

$("#grid").kendoGrid({ 
    dataSource: dataSource, 
    pageable: true, 
    height: 300, 

    toolbar: ["create"], 
    columns: [ 
    { 
     field: "stringEffectiveDate", title: "Date", 
     template: "#= kendo.toString(kendo.parseDate(EffectiveDate, 'yyyy-MM-dd'), 'yyyy-MM-dd') #", width: "100px", 
     sortable: { 
      allowUnsort: false, 
      compare: function (a, b, dir) { 
       return kendo.parseDate(a.EffectiveDate) - kendo.parseDate(b.EffectiveDate); 
      } 
     } 
    }, 
    { field: "EffectiveDate", title: "Effective Date", template: "#= kendo.toString(kendo.parseDate(EffectiveDate, 'yyyy-MM-dd'), 'yyyy-MM-dd') #", width: "100px" }, 
    { field: "ScaleMin", title: "BG1 Min", width: "100px" }, 
    { field: "ScaleMax", title: "BG7 Max", width: "100px" }, 
    { field: "Currency", title: "Currency", width: "100px" }, 
    { command: ["edit", "destroy"], title: "Commands", width: "160px" } 



    ], 
    height: 300, 
    scrollable: true, 
    sortable: true, 
    filterable: true, 
    pageable: true, 
    resizable: true, 
    selectable: true, 
    editable: "popup", 


    cancel: function (e) { 

     nEdit(); 
    }, 
    edit: function(e) { 
    e.container.find(".k-edit-label:first").hide(); 
    e.container.find(".k-edit-field:first").hide(); 
    if (!e.model.isNew()) { 
     var dt = e.container.find("input[name=EffectiveDate]").data("kendoDatePicker"); 
     dt.enable(false); 
    } 
    } 
}).css("background-color", "#C7D6A7"); 

當我點擊添加或編輯按鈕上顯示沒有彈出模式。以下是我的觀點的截圖。 enter image description here

回答

4

.andSelf在jQuery 3.0中被刪除。你正在引用3.1.1。您必須降級jQuery或找到Kendo的更新。