How to associate a data to a node in jstree?

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


        
7条回答
  •  孤城傲影
    2020-12-29 08:09

    The simplest way to do this is just like adding an attribute to an html element i.e.,

        var node = $.jstree._focused().get_selected(); //get the selected node or which ever you want the data to be associated with
        node.attr("expression","xyz"); //add an attribute (name,value) here, name-expression and value-xyz
    

提交回复
热议问题