zoukankan      html  css  js  c++  java
  • jstree onselect回调方法,获取选中节点的值 Fred


    应用jstree的onselect事件,获取当前选中的节点的名字,并且赋值给一个input:
    <script type="text/javascript">
    function log(str) {
        $(
    "#log").prepend(str + "<br />");
    }
    $(
    function () {
        $(
    "#demo").tree({
          data  : {
            type  : 
    "json",
            json  : [ 
              { attributes: { id : 
    "pjson4_1" }, data: "Root node 1", children : [
                { attributes: { id : 
    "pjson4_2" }, data: { title : "Custom icon", icon : "../media/images/ok.png" } },
                { attributes: { id : 
    "pjson4_3" }, data: "Child node 2" },
                { attributes: { id : 
    "pjson4_4" }, data: "Some other child node" }
              ]}, 
              { attributes: { id : 
    "pjson4_5" }, data: "Root node 2" } 
            ]
          },
          rules : {
            droppable : [ 
    "tree-drop" ],
            multiple : 
    true,
            deletable : 
    "all",
            draggable : 
    "all"
          },
          callback : {
                    
    onselect    : function (NODE) {    $("#txtSelectedValue").val($(NODE).children("a").text())} 

          }
        });
    });
    </script>
  • 相关阅读:
    java中断
    guava cache使用和源码分析
    redis基本类型和使用
    LRU Cache java实现
    HTTP长连接、短连接使用及测试
    mac下redis安装、设置、启动停止
    一次SocketException:Connection reset 异常排查
    【swift 结构体】
    【swift array 数组】
    【iOS知识汇】NSNotification
  • 原文地址:https://www.cnblogs.com/Fred_Xu/p/jstree_onselect_callback.html
Copyright © 2011-2022 走看看