主要代码如下:
javascript
rendertree: function () {
$('#lazy')
.jstree({
"themes": {
"stripes": true,
},
"types": {
"default" : {
"icon": "fa fa-user"
},
'nouser': {
"icon": 'fa fa-user-o'
}
},
"plugins": ["changed", "types"],
'core' : {
"data": {
"url": 'agent/agent/index/',
// "type": 'get',
"data": function (content) {
return { "agentid": content.id };
},
}
}
}).on("load_node.jstree",function(e,d){
// console.log(e)
// console.log(d)
var nodes = d.node.children_d;
for(var i in nodes){
var node = d.instance.get_node(nodes[i]);
if( !node.original.haschild ){
// d.instance.set_icon(node, 'nouser'); //nouser此处为class
d.instance.set_type(node, 'nouser');
}
}
});
},
1234567891011121314151617181920212223242526272829303132333435363738
源码(jstree.js)中修改:(需要返回haschild属性字段)
评论 (0)