Angularjs +剑道的UI树视图 [英] Angularjs + kendo-ui treeview

查看:130
本文介绍了Angularjs +剑道的UI树视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些路线:

when('/tvtest/:userid', {templateUrl: 'template/usertv', controller: SomeTest}).

它加载一些HTML与emebedded剑道的UI控件

which loads some html with emebedded kendo-ui controls:

<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和它不与路由工作,其打印你好,一些用户名,但它并不显示树状,它甚至不打印测试消息在控制台上,它甚至不尝试加载jQuery和剑道scipts。
是不是因为脚本标记的内容时,我加载某些模板被忽略?
我heared了解 angualr-剑道项目,但我很好奇是否有可能实现只有angularjs和剑道的UI框架之内?看来,我简单地做未便错...

It is sample treeview and it doesn't work with routing, it print "Hello", some user name, but it doesn't show treeview, it even doesn't print "test message" on console, it is even doesn't try to load jquery and kendo scipts. Is it because contents of script tag are ignored when I load some template? I heared about angualr-kendo project, but I'm curious whether it is possible to accomplish within only angularjs and kendo-ui frameworks? It seems that I simply doing smth wrong...

更新

好吧,我明白了角剑道之内的事情似乎是工作...
但我不能让树视图的工作:

Ok, I understood that within angular-kendo things seems to be working... But I cannot get treeview working:

我有控制,如:

function HomeCtrl($scope) {
  $scope.things = {
    dataSource: {
      data: [{ name: "Thing 1", id: 1 },
             { name: "Thing 2", id: 2 },
             { name: "Thing 3", id: 3 }]
    }   
}}

我的模板文件与下面的HTML返回:

I have template file returned with following html:

   <div  kendo-tree-view   
         k-data-source="things"
     k-data-text-field="'name'" />

但它没有工作...我在做什么错了?

But it doesn't work... What I'm doing wrong???

先谢谢了。

推荐答案

我从来没有能够得到一个剑道树视图,而无需使用 K-选项工作像以下内容:

I've never been able to get a kendo tree view working without using k-options like the following:

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'
}

这篇关于Angularjs +剑道的UI树视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆