滄海一幻覺
2021-05-03 15:53:14
一個簡單的問題,我想在每次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條經驗 獲得超8個贊
我不知道為什么...實際上該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
提交
取消