gpt4 book ai didi

kendo-ui - 从下拉列表中选择的 Kendo Treeview 值

转载 作者:行者123 更新时间:2023-12-03 22:51:14 27 4
gpt4 key购买 nike

在这里,我有一个 Kendo 下拉菜单和树状 View 。如果我从下拉列表中选择值,我想实现什么, Treeview 中的值将被选择(如下图)。感谢您的帮助。

  $("#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 + ")");
}
};

DEMO IN DOJO

enter image description here

最佳答案

你有: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-ui - 从下拉列表中选择的 Kendo Treeview 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57969763/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com