本文介绍了保存状态引导树视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用此组件保存状态 https://github.com/jonmiles/bootstrap-树状视图因此,我在这里修改了源代码: https ://github.com/jonmiles/bootstrap-treeview/blob/master/src/js/bootstrap-treeview.js

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

我在第104行中添加了代码:

and I have added in the line 104 the code:

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

,并在第1209行中输入代码:

and in the line 1209 the code:

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

所以当我执行代码时:

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

我有JSON数组.但是当在

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?

推荐答案

我已经解决了这个问题:

I have solve the problem:

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

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

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

这篇关于保存状态引导树视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 15:23