Kendo ツリー ビューでネストされたノードを見つけるための正確なルートを知っています。したがって、このルートに沿ってすべてのノードを展開して、そこに到達したいと考えています。ノードを見つけて、剣道にそのノードを展開させる方法を知っています。
私の Treeview は、そのデータに web-api を使用しており、すべて正常に動作します。スキーマは次のように定義されます。
schema: {
model: {
id: "CodeList",
hasChildren: "HasKids"
}
}
私が達成したいのは、ツリーがネストされたレベルに自動的に展開されることです。ノードに到達するためのパスが「Level1CodeA|Level2CodeA|Level3CodeA」であることがわかっているとします。そのため、最初に実行できるコード「Level1CodeA」を見つけたいとします。
次に、このノードを展開します (内部的にこのノードの下のデータを取得し、正常に展開されます)。その後、「Level2CodeA」を見つけ、プロセスを繰り返して、Level3CodeA も見つけて選択します。
これについてどうすればいいですか?次の検索および展開操作を開始するために使用できる「AfterExpanded」イベントを探していましたが、使用できるイベントが見つかりません。データソースで「変更」イベントを試しましたが、これが何度も発生し、正しいアイテムに絞り込めないようです..
どうもありがとう。
編集:より多くのコード
<script id="treeII-template" type="text/kendo-ui-template">
<img id="explorerItemImg" src="#: item.Image #" />
<span id="explorerItemCode">#: item.Code #</span> -
<span id="explorerItemFullName">#: item.FullName #</span>
# if (item.Level < (item.Levels - 1)) { #
[<span id="explorerItemLCount">#: item.LCount #</span>]
# } #
# if (item.HasKids) { #
[<span id="explorerItemPCount">#: item.PCount #</span>]
# } #
</script>
HierarchicalDataSource を作成し、これをツリービューに割り当てるコード:
// -----------------
// set the datasource for the bottom explorer...
// -----------------
var loadDataForExplorerGroup = function (context, groupid, groupsequence) {
// hang on to this context/groupid
sessionStorage.setItem(context + "_explorer_groupId", groupid);
sessionStorage.setItem(context + "_explorer_groupSequence", groupsequence);
// define the datasource and attach it to the explorer-tree
explorerGroupData = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "/api/explorerapi/GetExplorerData?",
data: {
context: "portfolio",
groupid: groupid,
groupsequence: groupsequence,
userid: sessionStorage.getItem("symUserID")
}
}
},
schema: {
model: {
id: "CodeList",
hasChildren: "HasKids"
}
}
});
// simply assign the data source again to the tree
$("#idExplBottomTree").data("kendoTreeView").setDataSource(explorerGroupData);
};