Kendo 从下拉列表中选择的树视图值
Kendo Treeview value selected from dropdown
这里我有一个 kendo 下拉菜单和树视图。如果我从下拉列表中 select 值,树视图中的值将被 select 编辑(如下图),我想实现什么。感谢您的帮助。
$("#dropdownlist").kendoDropDownList({
dataSource: [{ id:1, ledger: "Asset" },
{ id:2, ledger: "Current Asset" },
{ id:3, ledger: "Income" },
{ id:4, ledger: "Equity" },
{ id:5, ledger: "Sales" }],
dataTextField: "ledger",
dataValueField: "id",
select: onSelect
});
$("#treeview").kendoTreeView({
dataSource: [{ id:1, ledger: "Asset" },
{ id:2, ledger: "Current Asset" },
{ id:3, ledger: "Income" },
{ id:4, ledger: "Equity" },
{ id:5, ledger: "Sales" }],
dataTextField: "ledger",
dataValueField: "id"
});
function onSelect(e) {
if (e.dataItem) {
var dataItem = e.dataItem;
console.log("select (" + dataItem.ledger + " : " + dataItem.id + ")");
}
};
这里有:https://docs.telerik.com/kendo-ui/api/javascript/ui/treeview/methods/select
function onSelect(e) {
if (e.dataItem) {
var dataItem = e.dataItem;
var treeview = $("#treeview").data("kendoTreeView");
var bar = treeview.findByText(dataItem.ledger);
treeview.select(bar);
console.log("select (" + dataItem.ledger + " : " + dataItem.id + ")");
}
这里我有一个 kendo 下拉菜单和树视图。如果我从下拉列表中 select 值,树视图中的值将被 select 编辑(如下图),我想实现什么。感谢您的帮助。
$("#dropdownlist").kendoDropDownList({
dataSource: [{ id:1, ledger: "Asset" },
{ id:2, ledger: "Current Asset" },
{ id:3, ledger: "Income" },
{ id:4, ledger: "Equity" },
{ id:5, ledger: "Sales" }],
dataTextField: "ledger",
dataValueField: "id",
select: onSelect
});
$("#treeview").kendoTreeView({
dataSource: [{ id:1, ledger: "Asset" },
{ id:2, ledger: "Current Asset" },
{ id:3, ledger: "Income" },
{ id:4, ledger: "Equity" },
{ id:5, ledger: "Sales" }],
dataTextField: "ledger",
dataValueField: "id"
});
function onSelect(e) {
if (e.dataItem) {
var dataItem = e.dataItem;
console.log("select (" + dataItem.ledger + " : " + dataItem.id + ")");
}
};
这里有:https://docs.telerik.com/kendo-ui/api/javascript/ui/treeview/methods/select
function onSelect(e) {
if (e.dataItem) {
var dataItem = e.dataItem;
var treeview = $("#treeview").data("kendoTreeView");
var bar = treeview.findByText(dataItem.ledger);
treeview.select(bar);
console.log("select (" + dataItem.ledger + " : " + dataItem.id + ")");
}