douqun1977 2017-08-01 10:48
浏览 169

获取有关Kendo UI Treeview节点选择事件的额外信息

What I want

To populate a div based on the Kendo Treeview node click, based on some extra information which is based from the server-side.

What I am doing

Using PHP to send arrays as data to kendo treeview control, here is the code:

 <?php
        require_once 'telerik/wrappers/php/lib/Kendo/Autoload.php';

        $treeview = new \Kendo\UI\TreeView('treeview');

        $dataSource = new \Kendo\Data\DataSource();
        $dataSource->data($data);

        // The 'treeview_collapse' JavaScript function will handle the  'treeview_collapse' event of the treeview
        $treeview->collapse('treeview_collapse');

        //Configuring treeview's dataTextField and set its dataSource.
        $treeview
                ->dataTextField('value')
                ->dataSource($dataSource)
                ->collapse("onCollapse")
                ->expand("onExpand")
                ->select("onSelect")
                ->navigate("onNavigate");

        //Output the TreeView by echoing the result of the render method.
        echo $treeview->render();
        ?>

$data variable has the following value:

Array
(
    [0] => Array
        (
            [value] => Please select from the following menu
        )

    [1] => Array
        (
            [value] => 1. Manage Call Signature
            [type] => IMMEDIATE
            [closeSession] => false
            [items] => Array
                (
                    [0] => Array
                        (
                            [value] => Please select your service
                        )

                    [1] => Array
                        (
                            [value] => 1. Manage MyStatus
                            [type] => IMMEDIATE
                            [closeSession] => true
                            [items] => Array
                                (
                                    [0] => Array
                                        (
                                            [value] => We are processing your MS request, you will be informed via SMS shortly
                                        )

                                )

                        )

                    [2] => Array
                        (
                            [value] => 2. Manage IntroMe
                            [type] => IMMEDIAte
                            [closeSession] => true
                            [items] => Array
                                (
                                    [0] => Array
                                        (
                                            [value] => We are processing your IM request, you will be informed via SMS shortly
                                        )

                                )

                        )

                )

        )

    [2] => Array
        (
            [value] => 2. Subscribe
            [type] => FORWARD
            [closeSession] => false
            [forwardProtocol] => HTTPGET
        )

)

Through the above data this treeview is rendered

So I want to retrieve [type], [closeSession] and [items] as well whenever a node is clicked.

My Quetion

  1. How do I use template or any other technique to send extra info to the treeview

  2. Retrieve that (non-displayed) info on "onSelect" js event

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 有没有可以帮我搞一个微信建群链接,包括群名称和群资料群头像那种,不会让你白忙
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题