はい、これは可能です。実際、jstree を使用すると非常に簡単です。
やりたいことは、 jstree プラグインのajax
パラメーターを使用することですが、Web サービスがストアド プロシージャを呼び出すことができるように、拡張されたノード ID を送信する関数がまたはパラメーターに渡されるように設定します。選択したノードの子のデータを返します。json_data
data
url
これは、 http: //www.jstree.com/documentation/json_dataの例の 1 つを少し変更したものです。
$("#tree").jstree({
"json_data" : {
"ajax" : {
"url" : "/yourwebservice/getnodechildren",
"data" : function (node) {
//this is passed the node being opened
//or -1 if it's the root node
var dataToPass = {};
if (node === -1) {
//pass parameters to the webservice that will build and return
//first two tree levels
dataToPass = {
id : 0,
initialLoad: true
};
}
if (node.attr && node.attr("id") {
dataToPass = {
id: node.attr("id"),
initialLoad: false
}
}
return dataToPass;
},
"success" : function (dataFromWebservice) {
//depending on how the webservice returns
//data you may need to do this
return dataFromWebservice.d;
}
}
},
"plugins" : [ "themes", "json_data" ]
});
このコードをかなりエレガントにすることもできますが、それが要点です。これにより、一度にすべてではなく、必要に応じてチャンクでツリーを構築できます。
パラメータがURLで渡されるようにWebサービスが設定されている場合は、代わりにURLを関数にして、それを使用して、代わりにノードのIDまたは必要な他のパラメータを使用してURLリクエストを作成します.