jstree - 在 AJAX 完成后做一些事情
jstree - do something after AJAX done
简单的问题,我想在每次 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"
]
});
我不知道为什么...实际上 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"
]
});
简单的问题,我想在每次 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"
]
});
我不知道为什么...实际上 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"
]
});