/*
 * File: app/store/SelectApproverStore.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.SelectApproverStore', {
	extend: 'Ext.data.Store',

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

	constructor: function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([Ext.apply({
			filterOnLoad: false,
			model: 'MyApp.model.SelectIdText',
			remoteFilter: true,
			sortOnLoad: false,
			storeId: 'SelectApproverStore',
			clearOnPageLoad: false,
			proxy: {
				type: 'ajax',
				url: '../../service/sod_get_possible_approver.php',
				reader: {
					type: 'json'
				}
			},
			listeners: {
				beforeload: {
					fn: me.onJsonstoreBeforeLoad,
					scope: me
				},
				load: {
					fn: me.onJsonstoreLoad,
					scope: me
				}
			}
		}, cfg)]);
	},

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

	onJsonstoreLoad: function(store, records, successful, eOpts) {
		var myModel = store.model;
		var blankOption = new myModel({
			id: 0,
			text: '\u00a0'
		});
		store.insert(0, blankOption);
	}

});