0
我讀了很多關於jsTree/Json/metadat的建議,但是我沒有找到一個可行的解決方案。如果單擊節點,我想獲取元數據(例如id)。JsTree與Json-Data,不會得到元數據
月1日我的JSON數據:
其創建樹和應該得到的點擊ID(Ajax調用一些的Oracle APEX的東西)function populateTree(pRegionId) {
console.log('---Js Tree---');
$.ajax({
type : 'POST',
async : true,
url : 'wwv_flow.show',
data : {
"p_request" : 'APPLICATION_PROCESS=GET_TREE',
"p_flow_id" : $v('pFlowId'), // app id
"p_flow_step_id" : $v('pFlowStepId'), // page id
"p_instance" : $v('pInstance'), // session id
},
ggg : pRegionId,
success : function (data) {
console.log(data);
var jsonobj = JSON.parse(data);
apex.jQuery("#" + this.ggg).jstree({
"themes" : {
"theme" : "default",
"dots" : false,
"icons" : true
},
"json_data" : {
"data" : [jsonobj]
},
"plugins" : ["themes","json_data", "ui"]
//}).bind("select_node.jstree", function (e, data) { alert(data.rslt.obj.data("jstree").id); });
}).bind("select_node.jstree", function (e, data) {
console.log(data);
});
}
});
}
3的對象,其中
[
{
"data":{
"title":"TEST",
"icon":"/i/small_folder.gif",
"attr":{
"id":"1000000000000000021"
},
"metadata":{
"id":"1000000000000000021"
}
}
}
]
第二JS功能身份證應該是(螢火蟲domview):
args [a#1000000000000000301.jstree-clicked #, true, Object { originalEvent=Event click, type= "click", timeStamp=30977664, mehr...}]
inst Object { data={...}, get_settings=function(), _get_settings=function(), mehr...}
rlbk false
rslt Object { obj={...}, e={...}}
e Object { originalEvent=Event click, type="click", timeStamp=30977664, mehr...}
obj jQuery(li.jstree-closed)
如你所見,沒有身份證。所以我想元數據部分是雜亂的,但我不知道錯誤在哪裏。
在此先感謝 馬里奧
嘿@Mario,你能接受你自己的答案!這將標記問題解決,這將有助於其他誰絆倒在這個問題上。 – Tom 2013-02-21 08:55:48
謝謝湯姆。完成 – Mario 2013-02-21 10:06:13
非常感謝您的幫助! – Yashasvi 2014-07-02 11:12:12