/*
 * File: app/store/AddRoleToRuleTreeStore.js
 *
 * This file was generated by Sencha Architect version 3.0.2.
 * http://www.sencha.com/products/architect/
 *
 * This file requires use of the Ext JS 4.2.x library, under independent license.
 * License of Sencha Architect does not include license for Ext JS 4.2.x. For more
 * details see http://www.sencha.com/license or contact license@sencha.com.
 *
 * This file will be auto-generated each and everytime you save your project.
 *
 * Do NOT hand edit this file.
 */

Ext.define('MyApp.store.AddRoleToRuleTreeStore', {
	extend: 'Ext.data.TreeStore',

	requires: [
		'MyApp.model.AddRoleToRuleTreeModel',
		'Ext.data.proxy.Ajax',
		'Ext.data.reader.Json'
	],

	constructor: function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([Ext.apply({
			autoLoad: false,
			filterOnLoad: false,
			model: 'MyApp.model.AddRoleToRuleTreeModel',
			remoteFilter: true,
			remoteSort: true,
			sortOnLoad: false,
			storeId: 'AddRoleToRuleTreeStore',
			proxy: {
				type: 'ajax',
				url: '../../service/sod_critrole_get_roletree.php',
				reader: {
					type: 'json'
				}
			},
			listeners: {
				beforeload: {
					fn: me.onTreeStoreBeforeLoad,
					scope: me
				}
			}
		}, cfg)]);
	},

	onTreeStoreBeforeLoad: function(store, operation, eOpts) {
		var params = Ext.Object.fromQueryString(document.location.search);
		var filter = store.proxy.extraParams;
		var newParams = Ext.Object.merge(params, filter);
		store.proxy.extraParams = newParams;
	}

});