サーバー データに基づいて動的に生成されるツリー パネルがあります。以下は、ツリー パネルを生成してフォームに追加するコードです。
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"}}
ツリー パネル:
サーバー データを介してツリー パネル ノードをチェックするのを手伝ってください。
助けていただければ幸いです!
どうもありがとう :)