【问题标题】:save state bootstrap-treeview保存状态引导树视图
【发布时间】:2017-12-27 12:09:45
【问题描述】:

我需要用这个组件保存状态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
    });  

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

【问题讨论】:

    标签: javascript jquery bootstrap-treeview


    【解决方案1】:

    我已经解决了问题:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-13
      • 2012-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多