Jstree - 单击parent(json)

时间:2015-08-24 12:04:02

标签: javascript jquery json web jstree

我想在单击父节点后加载父节点的子节点。 因为有很多孩子,这是保持高性能的唯一方法。

现在我得到了这个

$(function () {
    $.support.cors = true;
    $('#using_json').jstree({
        "plugins": ["themes", "json_data", "dnd", "wholerow"],
            'core': {
            'data': {
                'url': "http://localhost:56311/ProductRESTService.svc/GetCountryList",
                    'dataType': "json"
            }
        }
    });
});

这适用于第一级。 现在我想从这个URL中获取孩子

http://localhost:56311/ProductRESTService.svc/GetRegionList/(编号)”,

我不知道如何实现这个目标?

编辑: 服务GetCountryList生成如下:

[{"id":"DE","parent":"#","state":"closed","text":"DE"},
{"id":"GBR","parent":"#","state":"closed","text":"GBR"},
{"id":"SE","parent":"#","state":"closed","text":"SE"}]

和GetRegionList

类似的东西:

[{"id":"SH","parent":"DE","state":"closed","text":"SH"},
{"id":"NRW","parent":"DE","state":"closed","text":"NRW"},
{"id":"LON","parent":"GBR","state":"closed","text":"LON"}]

1 个答案:

答案 0 :(得分:3)

使用此:

JSON_CALLBACK