解决方案 »

  1.   

    官方给出的demo格式如下:$('#using_json_2').jstree({ 'core' : {
        'data' : [
           { "id" : "ajson1", "parent" : "#", "text" : "Simple root node" },
           { "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
           { "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
           { "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
        ]
    } });我们在后台返回了[ .. ]里一样格式的内容,但是提示jstree不识别,不知道是我们哪里理解得有偏差
      

  2.   

    这个是官方给出的调用方式:// AJAX
    $('#tree').jstree({
        'core' : {
            'data' : {
                'url' : '/get/children/',
                'data' : function (node) {
                    return { 'id' : node.id };
                }
            }
        });调用方式和返回数据的格式都严格按照官方的说明来做,但结果就是不成功,相关支持文档很少,找不到原因~~
      

  3.   

    'data' : function (node) 
                      {
                             return { 'id' : node.id };
                      }
    能行??json还能传function?用惯了jquery的$.ajax么
      

  4.   

    知道封装吗?没有说这个是直接传给$.ajax,是经过判断口调用的。
    参考: jstree / src / jstree.js中第1092行开始的部分。