您好Kendo TreeView如下:
List<OUT_POMONTOCARLODATA> items = new List<OUT_POMONTOCARLODATA>();
OUT_POMONTOCARLODATA root = new OUT_POMONTOCARLODATA { id = 1, parent = 0, text = "Initiate" };
items.Add(root);
root = new OUT_POMONTOCARLODATA { id = 11, parent = 1, text = "Parts Selection" };
items.Add(root);
root = new OUT_POMONTOCARLODATA { id = 12, parent = 1, text = "Assumptions" };
items.Add(root);
root = new OUT_POMONTOCARLODATA { id = 13, parent = 1, text = "Team" };
var result = new JsonResult() { Data = items };
return result;
我从Controller绑定了这个treeView,如下所示:
$.ajax({
type: 'POST',
url: ResolveUrl("/CreateMaintainAnalysis/GetMontoCarloData"),
data: { AnalysisID: AnalysisID },
success: function (resultData) {
$("#AftermarketTreeView").data("kendoTreeView").dataSource.data(Data);
},
});
并使用Ajax我绑定它
var treeview = $("#AftermarketTreeView").data("kendoTreeView");
treeview.expand(treeview.findByText("Initiate"));
然后在JS中我想扩展如下:
var treeView = $("#AftermarketTreeView").data('kendoTreeView');
var dataSource = treeView.dataSource;
var dataItem = dataSource.get(1); // find item with id = 5
var node = treeView.findByUid(dataItem.uid);
treeView.expand(node);
OR
{{1}}
但两者都不适合我。