我有一条路:
when('/tvtest/:userid', {templateUrl: 'template/usertv', controller: SomeTest}).它加载一些带有隐藏的kendo-ui控件的html:
<html>
<head>
<title></title>
<script type="text/javascript" src="http://localhost:7000/myservice/script/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost:7000/myservice/script/kendo.all.min.js"></script>
</head>
<body>
<h1>{{"Hello"}}</h1>
<div id="example" class="k-content">
<div class="demo-section">
<ul id="treeview"/>
</div>
<script >
console.log("test message");
var dataSource = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "http://demos.kendoui.com/service/Employees",
dataType: "jsonp"
}
},
schema: {
model: {
id: "EmployeeId",
hasChildren: "HasEmployees"
}
}
});
$("#treeview").kendoTreeView({
dataSource: dataSource,
dataTextField: "FullName"
});
console.log(kendo);
dataSource.read();
</script>
{{user.UserName}}
</div>
</body>
</html>它是样例treeview,它不适用于路由,它打印一些用户名"Hello",但是它不显示treeview,它甚至不在控制台上打印“测试消息”,甚至不尝试加载jquery和kendo参数。是因为在加载模板时忽略了脚本标记的内容吗?我听说过角剑道项目,但我很好奇是否有可能只在AngularJS和kendo框架内完成呢?好像我做错了.
更新
好吧,我知道在角剑道范围内,事情似乎在起作用.但我无法让treeview工作:
我可以控制,就像:
function HomeCtrl($scope) {
$scope.things = {
dataSource: {
data: [{ name: "Thing 1", id: 1 },
{ name: "Thing 2", id: 2 },
{ name: "Thing 3", id: 3 }]
}
}}我返回的模板文件包含以下html:
<div kendo-tree-view
k-data-source="things"
k-data-text-field="'name'" />但不管用..。我做错什么了?
提前谢谢。
发布于 2013-09-02 01:45:26
在不使用k-options的情况下,我从未能够让剑道树视图工作,如下所示:
http://jsfiddle.net/L6vSX/
查看:
<div kendo-tree-view k-options="things">主计长:
$scope.things = {
dataSource: {
data: [{ name: "Thing 1", id: 1 },
{ name: "Thing 2", id: 2 },
{ name: "Thing 3", id: 3 }]
},
dataTextField: 'name'
}发布于 2014-07-15 23:00:20
我就是这样做的,它是这样运作的:
<div kendo-tree-view k-data-source="things" />
$scope.things = [
{ name: "Thing 1", id: 1 },
{ name: "Thing 2", id: 2 },
{ name: "Thing 3", id: 3 }
]https://stackoverflow.com/questions/18386992
复制相似问题