我有一个基于服务器数据动态生成的树面板。下面是生成树面板并将其添加到表单的代码。
Ext.Ajax.request({
url: '../Get_Menu.php',
method: 'POST',
success: function (result, request) {
var json = result.responseText;
var temp = Ext.decode(json);
var obj = {};
var item = {};
var menu = {};
var children = [];
var module = [{
"text": "Administrator",
"leaf": true,
"checked": false,
"id": "GROUP_ADMIN",
"formBind": true,
"name": "GROUP_ADMIN"
}];
for (var i = 0; i < Object.keys(temp.MENUS).length; i++) {
for (var key in temp.MENUS[i]) {
for (var n = 0; n < Object.keys(temp.MENUS[i][key]).length; n++) {
item = {
"text": temp.MENUS[i][key][n],
"checked": false,
"id": key + "_" + temp.MENUS[i][key][n],
"name": key + "_" + temp.MENUS[i][key][n],
"formBind": true,
"leaf": true
};
children.push(item);
}
menu = {
"text": key,
"leaf": false,
"id": key,
"children": children
};
module.push(menu);
children = [];
}
}
obj = {
"text": "Service Quality",
"expanded": true,
"formBind": true,
"children": module
};
Ext.getCmp('permissionsTreePanel').setRootNode(obj);
},
failure: function (result, request) {
Ext.Msg.alert('Error', 'An Error occured...');
}
});
我必须根据收到的服务器数据检查树面板的节点,如下所示:
{"PERMISSIONS":{"GROUP_ADMIN":"false","OPERATIONS_MSU":"true","OPERATIONS_SCHEDULE":"false","OPERATIONS_MARKET_DASHBOARD":"false","OPERATIONS_FE_REFERENCE":"true","PRODUCTION_QUICKQC_VOICE":"false","PRODUCTION_QUICKQC_DATA":"false","PRODUCTION_MARKETQC_VOICE":"false","PRODUCTION_MARKETQC_DATA":"false","PRODUCTION_SURGERY":"false","PRODUCTION_FILE_INVENTORY":"false","PRODUCTION_MARKET_TRACKER":"false","PRODUCTION_DRIVE_ROUTE_TRACKER":"false","PRODUCTION_TICKETS":"false","PRODUCTION_ASSETS":"false","MANAGEMENT_DAILY_STATUS":"false","MANAGEMENT_DAILY_PROCESSING":"false","MANAGEMENT_WEEKLY_WORKFLOW":"false","MANAGEMENT_CUSTOMER_QUESTIONS":"false","MANAGEMENT_KPI_PERFORMANCE_METRICS":"false","MANAGEMENT_COLLECTION_METRICS":"false","MANAGEMENT_OPERATIONS_DASHBOARD":"false","MANAGEMENT_PRODUCTION_DASHBOARD":"false","MANAGEMENT_SUPPORT_DASHBOARD":"false","MANAGEMENT_REVENUE_TRACKER":"false","MANAGEMENT_DEPLOYMENT_TRACKER":"false","SUPPORT_TICKETS":"false","SUPPORT_ASSET_MANAGEMENT":"false","SUPPORT_GENERATE_SHIPMENT":"false","TRAINING_RESOURCES":"false","TRAINING_SCHEDULE":"false"}}
树面板:
请帮助我通过服务器数据检查树面板节点。
帮助将不胜感激!
非常感谢 :)