0
我有一個基於服務器數據動態生成的樹面板。以下是生成樹面板並將其添加到表單的代碼。如何根據extjs中的服務器數據檢查treepanel節點?
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"}}
樹面板:
請幫我在得到樹面板通過服務器數據檢查節點。
幫助將不勝感激!
非常感謝:)
非常感謝:) –