Kendo DataSource: How to define “Computed” Properties for data read from remote odata source

前端 未结 3 1055
自闭症患者
自闭症患者 2021-01-15 06:11

Situation:

  • kendo DataSource

    var ordersDataSource = new kendo.data.DataSource({
        type: \"odata\",
        transport: {
            read: {
                    
    
    
            
3条回答
  •  没有蜡笔的小新
    2021-01-15 06:41

    You can create a calculated field by specifying the model of the data source:

      dataSource = new kendo.data.DataSource({
        data: [
          { first: "John", last: "Doe" }, 
          { first: "Jane", last: "Doe" }
        ],
        schema: {
          model: {
            // Calculated field
            fullName: function() {
              return this.get("first") + " " + this.get("last");
            }
          }
        }
      });
    

    Here is a live demo: http://jsbin.com/ojomul/1/edit

提交回复
热议问题