简体   繁体   中英

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

There are many jQuery plugins for creating a checkbox tree view, but I can't find documentation of loading data from a server using AJAX. For example this link .

I want something like this:

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

Or using classic ajax format

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

I tried using second technique on one plugin but it failed. I did this:

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

Kindly help me so that I can continue my work. Thank you.

I used DynaTree, it has a lot of documentation. Here is a Link it has a lot of old versions which are comparable with old jquery.

i just had to write this much code.

    $("#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"
            }
        },

  });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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