2016-10-06 10 views
0

私はKendo TreeListコンポーネントを使用しており、オンデマンドリモートデータを処理しようとしています。これは、データソースは、次のようになります。剣道UI TreeListDatasourceリモートデータオンデマンドIDがnull

dsLocations = new kendo.data.TreeListDataSource({ 
    transport: { 
     read: { 
      url: baseUrl + "getsuggestedorganizationlocations?oid=" + $("#Id").val(), 
      dataType: "json" 
     }, 

     schema: { 
      model: { 
       id: "Id", 
       parentId: "ParentId", 
       fields: { 
        Id: { type: "number", nullable: false }, 
        ParentId: { field: "ParentId", nullable: true } 
       } 
      } 
     } 
    } 
}); 

これはTreeListコンポーネントが設定されている方法です。

$("#suggestedLocations").kendoTreeList({ 
    dataSource: dsLocations, 
    columns: [ 
     { field: "Name", expandable: true, title: "Location", width: 250 }, 
     { field: "Selected", title: "Selected" } 
    ] 
}); 

をそしてこれは、サーバからのデータは、rootのように見えるものです:

[{"Id":5,"ParentId":null,"Selected":true,"hasChildren":true,"Name":"Kitchen"}] 

ノードを展開して子を取得すると、サーバーに渡されるクエリ文字列の「id」は空です。

Empty id

私は私のモデルはにサーバーから変更する場合:

idとPARENTIDが下部ケースです
[{"id":5,"parentId":null,"Selected":true,"hasChildren":true,Name":"Kitchen"}] 

、それが動作します。私の理解は、スキーマ構成はそれをマップすると仮定しています。何と私は行方不明?

私は剣道を使用しています。2016.3.914

答えて

0

見つかりました。私は、スキーマ設定をトランスポート設定内に配置しました。それは次のようなものです:

dsLocations = new kendo.data.TreeListDataSource({ 
    transport: { 
     read: { 
      url: _organizeApp.baseUrl + "getsuggestedorganizationlocations?oid=" + $("#Id").val(), 
      dataType: "json" 
     } 

    }, 
    schema: { 
     model: { 
      id: "Id", 
      parentId: "ParentId", 
      fields: { 
       Id: { field: "Id", type: "number", nullable: false }, 
       ParentId: { field: "ParentId", nullable: true }, 

      } 
     } 
    } 
});