2015-01-02 20 views
0

我想向Kendo計劃程序添加共享功能,爲了實現此目的,我希望共享字段成爲複雜對象,而不僅僅是一個簡單的例子。如何將複雜對象綁定到Kendo計劃程序中的字段

所以我想要做的是以下幾點:

schema: { 
     model: { 
      id: "taskId", 
      fields: { 
       taskId: { from: "Id", type: "number" }, 
       title: { from: "Title", defaultValue: "No title", validation: { required: true }        }, 
       start: { type: "date", from: "StartsOn" }, 
       end: { type: "date", from: "EndsOn" }, 


       Share:[ 
        { 
         user: { from: "users", defaultValue: 1 }, //users is a resource 
         right: { from: "rights", defaultValue: 1 }, 
        }], 
      } 
     } 

任何人可以幫助我嗎?

回答

0

你可以做的是使用模式:{parse:}。

根據API文檔爲劍術

解析

服務器響應之前執行被使用。用它來預處理或者解析服務器響應。

我用它在CoffeeScript中,像這樣:

schema: 
    model: 
    id: "id" 
    fields: 
     id: editable: false 
     title: from: "name" 
    parse: (response)-> 
    $(response).each -> 
     this.share = [{user: this.users, right: this.rights}] 
    return response 
相關問題