我想一直显示我的 Kendo UI TreeView 展开,但它只会显示折叠。重新加载数据源时,我可以看到展开树的一闪而过,但随后它崩溃了。
var locationTreeView = $("#treeViewLocations").kendoTreeView({
checkboxes: {
checkChildren: false,
template: "# if(item.showCheckbox){# <input type='checkbox' name='selectedLocations' value='#= item.value #' />#}#"
},
dataTextField: "text",
dataSource: {
transport: {
read: {
url: window.location.origin + "/api/v1/bookingrequestlocation",
dataType: "json",
type: "GET",
data: { bookingSeasonPeriodId: bookingSeasonPeriod.value() },
}
},
schema: {
model: {
id: "value",
children: "items",
hasChildren: "hasChildren",
}
}
}}).data("kendoTreeView");
expandTreeView();
function changeSeason() {
locationTreeView.dataSource.read();
expandTreeView();}
function expandTreeView() {
locationTreeView.expand(".k-item");}
最佳答案
在数据绑定(bind)事件中触发 expandTreeView() 函数
关于kendo-ui - 无法展开 Kendo TreeView 中的所有节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21599941/