{
	xtype: 'container',
	border: false,
	layout: "fit",
	bodyStyle: 'background-image: none;',
	title: "",
	require: [
		"Ext.ux.navigation.viewmodel.RolePermissionTree",
		"Ext.ux.navigation.controller.RolePermissionMenuTree",
		"Ext.ux.navigation.view.RolePermissionMenuTree"
	],
	onInitialize: function(widget, owner) {

		var i_self = this;
		var i_record = owner.dataParent.getRecord()
		i_self.getList(i_record, function(a_result) {
			var i_permissions = Ext.widget("rolepermissionmenutree", {
				record: i_record,
				permissions: a_result
			});

			i_self.permissions = i_permissions;

			i_self.add(i_permissions);
		});
	},

	doSave: function(f_callback) {

		var i_permissions = this.permissions;
		var i_controller = i_permissions.getController();
		i_controller.doSave(function() {
			f_callback && f_callback();
		});


	},

	getList: function(i_record, f_callback) {

		Ext.Ajax.request({
			url: "/ip2-services/ip2transaction.aspx.json",
			method: 'POST',
			jsonData: {
				action: 'ip2NavProxy.getRoleMenuPermission',
				roletoken: i_record.get(i_record.idProperty)
			},
			faliure: function() {
				var a_result = [];
				f_callback(a_result);
			},
			success: function(response, request) {
				var a_result;
				try {
					a_result = JSON.parse(response.responseText);
				}
				catch (err) {
					a_result = [];
				}

				f_callback(a_result);
			}
		});
		// f_callback({
		// 	rows: []
		// })

	},

	doDelete: function(f_callback) {

		var i_permissions = this.permissions;
		var i_controller = i_permissions.getController();
		i_controller.doDelete(function() {
			f_callback && f_callback();
		});
	},

	isDirty: function() {

		var i_self = this;
		var b_dirty = false;
		if (i_self.permissions) {
			var i_permissions = this.permissions;
			var i_controller = i_permissions.getController();
			b_dirty = i_controller.isDirty();
		}
		else {
			b_dirty = i_self.ownerCt.isDirty();
		}

		return b_dirty
	}
}
