一个简单的问题,我想在每次jstree AJAX加载完成时执行一些操作,例如$('[data-toggle="tooltip"]').tooltip();..下面是我的代码:$('#jstree').jstree({ "core": { 'themes': { //dots:false }, 'data': { 'url': function(node) { return 'http://localhost:4044/admin/users/tree/get'; }, 'success': function(){ //currently, this is not working $('[data-toggle="tooltip"]').tooltip(); } } }, 'types': { 'default': { "icon": "mdi mdi-account text-warning-dark", } }, "plugins": [ "types" ]});
1 回答

largeQ
TA贡献2039条经验 获得超7个赞
我不知道为什么...实际上该success属性已经正确,但是为了使tooltip工作正常,我需要将其包括在内setTimeout...
我在下面编写了代码,它可以正常工作!
$('#jstree').jstree({
"core": {
'themes': {
//dots:false
},
'data': {
'url': function(node) {
return 'http://localhost:4044/admin/users/tree/get';
},
'success': function(){
setTimeout(function(){ //add setTimeout
$('[data-toggle="tooltip"]').tooltip();
}, 100);
}
}
},
'types': {
'default': {
"icon": "mdi mdi-account text-warning-dark",
}
},
"plugins": [
"types"
]
});
添加回答
举报
0/150
提交
取消