How to associate a data to a node in jstree?

后端 未结 7 1940
温柔的废话
温柔的废话 2020-12-29 07:12
$(\"#ifTree\").jstree({
            \"plugins\" : [\"themes\",\"html_data\",\"ui\",\"crrm\"], 
            \"themes\" : {
                    \"theme\" : \"apple\",
         


        
7条回答
  •  我在风中等你
    2020-12-29 08:06

    Proper way to associate a data to node is as follows:

    If you are adding more data i.e. attribute then mentioned all attributes (name, value) under "attr" property

    "attr":{ attributeName1:"attributeValue1", attributeName2:"attributeValue2"...... }

     $("#createIf_c").click(function () { 
     $("#ifTree").jstree("create",null,"inside",
       { "data" : "testNodeName", 
          "attr": { title:"if",value:"expression"} },  function() {}, true);
    });
    

提交回复
热议问题