保存状态 bootstrap-treeview

save state bootstrap-treeview

我需要用这个组件保存状态https://github.com/jonmiles/bootstrap-treeview 所以我在这里修改了源代码:https://github.com/jonmiles/bootstrap-treeview/blob/master/src/js/bootstrap-treeview.js

我在第 104 行添加了代码:

getNodes: $.proxy(this.getNodes, this),

第 1209 行代码:

Tree.prototype.getNodes= function (options) {
            console.log("--- getNodes ---");
           return this.nodes
     };

所以当我执行代码时:

var jsonData=x$(idTree).treeview('getNodes', { silent: true }); 

我有 JSON 数组。 但是当在

中使用这个 JSON 数组时
var objTree=$("idTree").treeview({
      data: jsonData,         // data is not optional
       color: "#428bca",
             expandIcon: 'glyphicon glyphicon-chevron-right',
              collapseIcon: 'glyphicon glyphicon-chevron-down',
              //nodeIcon: 'glyphicon glyphicon-bookmark',
              showTags: true,
              enableLinks:true
    });  

这会在大纲中的渲染树中产生问题...您有什么建议吗?

我已经解决了问题:

我的问题是 return 值..这是正确的方法 --> this.tree

Tree.prototype.getNodes= function (options) {
            console.log("--- getNodes ---");
           return this.tree
     };