2016-08-16 74 views
0

我想填充剑道的TreeView其中2个节点的本地数据源和最后一个节点应该是远程数据源本地和远程数据源,以剑道树形

这里是我的代码:

$("#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, 
                  } 
                 }, 
                } 
               } 
              } 
             } 

            } 
           } 
          } 
         }); 

以上使用代码我得到的结构如下 哪里启动和分析本地数据源和蒙托卡罗是远程数据源,但我不希望该节点再次成为蒙托卡洛它应该是直接从数据库远程数据源

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);结果是合并的dataSource(远程和本地)。

+0

我尝试过,但因为我是新的剑道......无法理解需要放置的位置和位置 – SantyEssac