weixin_33682719 2013-06-05 06:37
浏览 10

Kendo UI叶节点问题

I have this table http://sqlfiddle.com/#!2/06e35

I am creating kendo-ui tree http://demos.kendoui.com/web/treeview/remote-data.html

here is my jQuery code

        <script>
            var serviceRoot = "search/treej.php";
                homogeneous = new kendo.data.HierarchicalDataSource({
                    transport: {
                        read: {
                            url: serviceRoot,
                            dataType: "jsonp"
                        }
                    },
                    schema: {
                        model: {
                            id: "entity_id",
                            hasChildren: "child"
                        }
                    }
                });

            $("#treeview").kendoTreeView({
                dataSource: homogeneous,
                dataTextField: "value"
            });
        </script>

this is my treej.php file

<?php
// database connection

$id_check = $_REQUEST['entity_id'];
$callback = $_REQUEST['callback'];

if($id_check == ''){
    $tree_result = $conn->query("SELECT entity_id, value, parent_id as ReportsTo, child From test2 Where parent_id = 0");
}else{
    $tree_result = $conn->query("SELECT entity_id, value, parent_id as ReportsTo, child From test2 Where parent_id = (".$id_check.")");
}

$data = array();
foreach($tree_result as $row) {
    $data[] = $row;
}

header('Content-Type: application/json');
$j_data =  json_encode($data);
echo $callback.'('.$j_data.')';
?>

The problem is the leaf nodes also displays > while in the database, child is false

here is the output

enter image description here

In this image, node with red aero should not display > expand icon

here is HTML

    <div class="k-content" id="example">
        <div class="demo-section k-widget k-treeview" id="treeview" data-role="treeview" tabindex="0" role="tree" aria-activedescendant="treeview_tv_active">
        <ul role="group" class="k-group k-treeview-lines">
            <li data-uid="0826702e-556f-4a04-9e16-4e17481d8d7e" class="k-item k-first k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-top k-bot"><span role="presentation" class="k-icon k-minus"></span><span class="k-in">Root</span></div><ul role="group" class="k-group" style="display: block;">
            <li data-uid="2109e3d0-efdf-4e18-b772-f6d258addd4f" class="k-item" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-top"><span role="presentation" class="k-icon k-minus"></span><span class="k-in">level 0A</span></div><ul role="group" class="k-group" style="display: block;">
            <li data-uid="320d3043-89b9-4abb-b83b-d34c3ebe8d0b" class="k-item k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-bot"><span role="presentation" class="k-icon k-minus"></span><span class="k-in">Leval 1-A</span></div><ul role="group" class="k-group" style="display: block;">
            <li data-uid="f17fa56e-6c2c-48ec-b930-2691705a6904" class="k-item" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-top"><span role="presentation" class="k-icon k-minus"></span><span class="k-in">level 2A</span></div><ul role="group" class="k-group" style="display: block;">
            <li data-uid="e9ff454c-6ce5-4237-9ac5-7a306fb63401" class="k-item" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-top"><span class="k-in">level 3A1</span></div></li>
            <li data-uid="491243fb-0654-4e8d-8637-f81367c364bf" class="k-item k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-bot"><span class="k-in">level 3A2</span></div></li></ul></li>
            <li data-uid="025389fa-359c-45af-929e-065d43f3c385" class="k-item k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-bot"><span role="presentation" class="k-icon k-minus"></span><span class="k-in">level 2B</span></div><ul role="group" class="k-group" style="display: block;">
            <li data-uid="8220eaff-c005-440d-9144-318711c835fc" class="k-item" role="treeitem" data-expanded="true" aria-expanded="true" id="treeview_tv_active"><div class="k-top"><span class="k-in">level 3B1</span></div></li>
            <li data-uid="93afa526-9285-4ea5-be2d-3bc344cb9089" class="k-item k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-bot"><span class="k-in">level 3B2</span></div></li></ul></li></ul></li></ul></li>
            <li data-uid="86fedc22-c262-48ac-a1ad-c516a69583aa" class="k-item k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-bot"><span role="presentation" class="k-icon k-minus"></span><span class="k-in">level 0B</span></div><ul role="group" class="k-group" style="display: block;">
            <li data-uid="98b08705-8db6-4759-88a9-d8d468c59fd8" class="k-item" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-top"><span class="k-in">level 1.1 B</span></div></li>
            <li data-uid="750b5ae2-b445-41e9-95f7-e6e3be396f1d" class="k-item k-last" role="treeitem" data-expanded="true" aria-expanded="true"><div class="k-bot"><span class="k-in">Level 1.2 B</span></div></li></ul></li></ul></li>
        </ul></div>
    </div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 c语言写的8051单片机存储器mt29的模块程序
    • ¥60 求直线方程 使平面上n个点在直线同侧并且距离总和最小
    • ¥50 java算法,给定试题的难度数量(简单,普通,困难),和试题类型数量(单选,多选,判断),以及题库中各种类型的题有多少道,求能否随机抽题。
    • ¥50 rk3588板端推理
    • ¥250 opencv怎么去掉 数字0中间的斜杠。
    • ¥15 这种情况的伯德图和奈奎斯特曲线怎么分析?
    • ¥250 paddleocr带斜线的0很容易识别成9
    • ¥15 电子档案元素采集(tiff及PDF扫描图片)
    • ¥15 flink-sql-connector-rabbitmq使用
    • ¥15 zynq7015,PCIE读写延时偏大