猿问

jstree-在完成AJAX之后执行一些操作

一个简单的问题,我想在每次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"

  ]

});


沧海一幻觉
浏览 164回答 1
1回答

largeQ

我不知道为什么...实际上该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"  ]});
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答