save state bootstrap-treeview

不问归期 提交于 2019-12-11 14:05:42

问题


I need to save the state with this component https://github.com/jonmiles/bootstrap-treeview So I have modify the source code here: https://github.com/jonmiles/bootstrap-treeview/blob/master/src/js/bootstrap-treeview.js

and I have added in the line 104 the code:

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

and in the line 1209 the code:

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

So when I execute the code :

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

I have the JSON array. But when Use this JSON array in the

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
    });  

This generate problem in render tree in the outline...have you any suggestion?


回答1:


I have solve the problem:

my problem is the return value.. and this is correct way--> this.tree

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


来源:https://stackoverflow.com/questions/47991955/save-state-bootstrap-treeview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!