2016-08-16 24 views
0

私は剣道ツリービューを移入したいが、私のコードです:上記の使用ローカルおよびリモートデータソース

$("#AftermarketTreeView").kendoTreeView({ 
          dataTextField: ["text", "text", "MC_ANALYSIS_NAME"], 
          dataSource: { 
           data: [ 
            { 
             text: "Initiate", 
             items: [ 
             { text: "Parts Selection", haschildren: false }, 
             { text: "Assumptions", haschildren: false }, 
             { text: "Team", haschildren: false }, 
             ] 
            }, 
            { 
             text: "Analyze", 
             items: [ 
             { text: "Part Attributes", haschildren: false }, 
             { text: "Aftermarket Evaluation", haschildren: false } 
             ] 
            }, 
            { 
             text: "Monto Carlo", 
             items: [ 
             { text: "Monto Carlo", haschildren: true } 

             ] 
            } 
           ], 
           schema: { 
            model: { 
             hasChildren: "items", 

             children: { 
              schema: { 
               data: "items", 
               model: { 
                hasChildren: "haschildren", 
                children: { 
                 schema: { 
                  // override the schema.data setting from the parent 
                  data: function (response) { 
                   return response; 
                  } 
                 }, 
                 transport: { 
                  read: { 
                   url: ResolveUrl("/CreateMaintainAnalysis/GetMontoCarloData/"), 
                   dataType: "jsonp", 
                   data:onDataSendAnalysisID, 
                  } 
                 }, 
                } 
               } 
              } 
             } 

            } 
           } 
          } 
         }); 

コード私は以下のような構造になっています InitiateとAnalyzeはローカルDataSourceで、Monto CarloはリモートDataSourceですが、ノードからMonto Carloになることは望ましくありません。データベースから直接リモートDataSourceになる必要があります

enter image description here これで解決するのを手伝ってください

ありがとうございました!!!

答えて

0

あなたは、関数にあなたの読み取りプロパティを変更することができます。

read: function(options) { /* here you can do the ajax call for the remote dataSource and then you can merge the local dataSource with the remote dataSource, you can create a new array to accomplish this. */ } 

あなたはhereの例を見ることができます。 考え方はoptions.success(result)を使用することです。結果はマージされたデータソース(リモートおよびローカル)になります。

+0

私は剣道を初めて知りましたが、どこに何を配置する必要があるのか​​理解できません – SantyEssac

関連する問題