2012-11-23 28 views
1

我是一個kendoUI網格從網絡服務中做CRUD。出於某種原因,讀取命令完美工作,並填充我的網格。Kendo UI網格不觸發傳輸創建URL

但是當我嘗試創建一個新的記錄,儘管它顯示在網格中的新記錄並保存不會觸發web服務我可以修改它的字段,按鈕。

檢出http日誌,我沒有看到服務命中。只有在「閱讀」。

這是網格的代碼:

$(function() { 
      $("#grid").kendoGrid({ 
       dataSource: { 
        transport: { 
         read: "libyMsg.php?way=getUsrMsgList" 
        }, 
        create: { 
         url: "libyMsg.php?way=createMsg", 
         type: "PUT" 
        }, 
        update: { 
         url: "libyMsg.php?way=updateeMsg", 
         type: "PUT" 
        },destroy: { 
         url: "libyMsg.php?way=destroyMsg", 
         type: "PUT" 
        }, 
        batch: true, 
        pageSize: 10, 
        schema: { 
         data: "data", 
         model: { 
          id: "msg_id", 
          fields: { 
           msg_id: { editable: false, nullable: true }, 
           msg_title: { validation: { required: true } }, 
           msg_content: { validation: { required: true } }, 
           msg_type: { type: "number", validation: { min: 0, required: true }}, 
           msg_date: { type: "date", validation: { required: true } }, 
           msg_status: { type: "number", validation: { min: 0, required: true } } 
          } 
         } 
        }, 
       }, 
       columns: [{ field: "msg_id", width: 40,title: "ID" }, 
        { field: "msg_title",width: 300, title: "Title" }, 
        { field: "msg_content", width: 300,title: "Content" }, 
        { field: "msg_type", width: 40,title: "Type" }, 
        { field: "msg_date", width: 300,title: "Date" }, 
        { field: "msg_status", width: 40,title: "Status" }], 
       scrollable: true, 
       sortable: true, 
       editable:true, 
       pageable: { 
        refresh: true, 
        pageSizes: true 
       }, 
       toolbar: ["create", "save", "cancel"], 
      }); 
     }); 

這是推動我瘋了。任何人?

Ty/M

回答

5

您的transport是錯誤的。試試這個:

transport:{ 
    read  :"libyMsg.php?way=getUsrMsgList", 
    create :{ 
     url :"libyMsg.php?way=createMsg", 
     type:"PUT" 
    }, 
    update :{ 
     url :"libyMsg.php?way=updateeMsg", 
     type:"PUT" 
    }, 
    destroy:{ 
     url :"libyMsg.php?way=destroyMsg", 
     type:"PUT" 
    } 
}, 

createupdatedestroy應該是transport一部分。

+0

完美的作品埃米利亞諾,謝謝! – Martha