2014-10-20 68 views
0

我想捕捉事件時,有人點擊編輯按鈕在網格中,我想調用OnEdit函數,它不工作任何解決方案?Kendo Grid用戶界面編輯值但未保存

<script>  
// When user clicks on edit button command i would like to call this function. 
function onEdit(e) { 
    alert('onEdit'); 
    } 

// Kendo grid code for populating the data from ajax call and edit function. This is starting point where all events and datasource is populated. 

$(document).ready(function() { 
      dataSource = new kendo.data.DataSource({ 
       transport: { 
        update: { // Update event 
        type: "POST", 
         url: BASE_URL + "admin/updatePublisher.htm", 
         contentType: "application/json; charset=utf-8", 
         dataType: "json" 
         success: function (result) { // success will save the data 
          options.success(result); 
         } 
        }, 
        parameterMap: function(options, operation) { // Update is clicked or created this is place it will reach. 
       }, 
       batch: true,pageSize: 50, 
       schema: { 
       type: "json", 
        model: { 
         id: "id", 
         fields: { 
          id: { 
           editable: false,nullable: true,type: "number" 
          } 
         } 
        }, 
        data: "items" // the items return from ajax 
       }, 
      }); // end of datasource 

//劍道UI $( 「#電網」)kendoGrid({數據源:數據源,可導航:真,分頁:真,
工具欄:[{名: 「創造」,文:「添加發布商「}],//工具欄菜單 列:[{field:」publisherName「},{command:[」edit「],title:」Actions「}],editable:」inline「 }); });

回答

1

我找到了解決我的問題,希望對某人有用。編輯kendoGrid屬性是解決我的問題。

 $("#grid").kendoGrid({ 
     dataSource: dataSource, 
     navigatable: true, 
     pageable: true, 
     edit  : function (e) { 
      // Write your code 
      },    
     height: 550,   
     toolbar: [{ name: "create", text: "Add Creater"}], 
     columns: [{ 
      field: "emailCreativeName", 
      title: "Email Creater", 
      width: "350px" 
     },{ command: ["edit"], title: "Actions", width: "200px" }], 
     editable: "inline" 
    });