gpt4 book ai didi

kendo-ui - 未捕获的类型错误 : Cannot read property 'replace' of undefined with KendoTreeView`

转载 作者:行者123 更新时间:2023-12-04 06:20:29 27 4
gpt4 key购买 nike

下面是我的 KendoUI Treeview ,我使用模板在每个节点上显示编辑链接,但我收到此错误:“未捕获的类型错误:无法读取未定义的属性‘替换’”

 @section scripts{
<script src="~/scripts/kendo.all.min.js"></script>

<script type="text/javascript">

var territory = new kendo.data.HierarchicalDataSource({
transport: {
read: {
type:'POST',
url: rootURL + "Territory/AllTerritories",
dataType: "json"
}
},
schema: {
model: {
id: "ID",
hasChildren: "HasChildren",
children: territory

}
}
});

$("#treeview").kendoTreeView({
dataSource: territory,
dataTextField: "Name",
dataValueField: "ID",
template: kendo.template($("#treeview-template").html())
});

</script>



}

<script id="treeview-template" type="text/kendo-ui-template">
#
<a class='show-link' href='\#'><image src="/Content/images/select2.png"></a> #
</script>
<style scoped>
#territoryTree {
text-align: center;
}
#treeview .k-sprite {
background-image: url("../content/default/coloricons-sprite.png");

}
.rootfolder {
background-position: 0 0;
}
.demo-section {
display: inline-block;
vertical-align: text-bottom;
min-width: 320px;
min-height: 300px;
text-align: left;
margin: 0 2em;
}
</style>

有什么解决办法吗??请帮忙

最佳答案

jquery 找不到 ID 为 #treeview-template 的元素当你说

kendo.template($("#treeview-template").html())

然后它首先会尝试找到 ID 为 #treeview-template 的 html 元素然后它会前进。通过写 $("#treeview-template").html() 尝试 F12 和控制台在控制台中查看是否可以找到该元素

关于kendo-ui - 未捕获的类型错误 : Cannot read property 'replace' of undefined with KendoTreeView`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24449920/

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