繁体   English   中英

无法在树形视图插件中从服务器加载AJAX数据

[英]Can not load AJAX data from the server in tree view plugin

有许多用于创建复选框树形视图的jQuery插件,但是我找不到使用AJAX从服务器加载数据的文档。 例如这个链接

我想要这样的东西:

$('#CheckBoxTree').LoadTreeView('/WebHandler/GetData.ashx') {
}

或使用经典的ajax格式

$.ajax({
    url: '/WebHandler/Data.ashx',
    async: true,
    dataType: 'json',
    data: { proname: 'pro' },
    success: function (dataa) {
        $('#CheckBoxTree').SetData(dataa)
    });
}
});

我尝试对一个插件使用第二种技术,但失败了。 我这样做:

$.ajax({
    url: '/WebHandler/GetPlotData.ashx',
    async: true,
    dataType: 'json',
    data: { proname: 'province' },
    success: function (dataa) {
        debugger
        $('#tree-container').highCheckTree({                    
            data: dataa
        });
    }
});

请帮助我,以便我继续工作。 谢谢。

我用过DynaTree,它有很多文档。 这是一个链接,它有很多旧版本,可与旧的jQuery媲美。

我只需要编写这么多代码。

    $("#tree").dynatree({
        checkbox: true,
        autoCollapse: false,
        activeVisible: true,
        persist: true,
      //  selectMode: 1,
        onLazyRead: function (node) {           
            node.appendAjax({
                url: "/WebHandler/GetPlotData.ashx",
                data: {
                    "proname": "district",
                     "key":node.data.key,
                    "mode": "all"
                }
            });
        },
        initAjax: {
            url: "/WebHandler/GetPlotData.ashx",
            data: {proname: "province", // Optional arguments to append to the url
                mode: "all"
            }
        },

  });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM