我需要使用此组件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
});
这会在大纲中的渲染树中产生问题......你有什么建议吗?
答案 0 :(得分:0)
我已经解决了这个问题:
我的问题是返回值..这是正确的方法 - >的 this.tree 强>
Tree.prototype.getNodes= function (options) {
console.log("--- getNodes ---");
return this.tree
};