为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

沧海一幻觉 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条经验 获得超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"

  ]

});


查看完整回答
反对 回复 2021-05-13
  • 1 回答
  • 0 关注
  • 163 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信