/*
 * Copyright (c) 2009 The Olympos Development Team.
 * 
 * http://sourceforge.net/projects/olympos/
 * 
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html. If redistributing this code, this
 * entire header must remain intact.
 */
Ext.namespace("cwe.navigation");

/**
 * @class Loads the data for a model grid.
 * 
 * @extends Ext.data.Store
 * @constructor
 * @see cwe.navigationgrid.ModelGrid
 * @param {Object}
 *            config The configuration object.
 * @config modelDescription The Model Description to load object of.
 */
cwe.navigation.GlobalSearchStore = function(config) {
	this.templateRecord = Ext.data.Record.create( [ {
	    name : "oid",
	    mapping : "oid"
	}, {
	    name : "iconClass",
	    mapping : "iconClass"
	}, {
	    name : "label",
	    mapping : "label"
	}, {
	    name : "cwe-relative-relevance",
	    mapping : "cwe-relative-relevance"
	}, {
	    name : "record",
	    mapping : "record"
	} ]);

	var exampleRecord = new this.templateRecord();

	cwe.navigation.GlobalSearchStore.superclass.constructor.call(this, Ext.apply( {
	    proxy : new cwe.navigation.GlobalSearchProxy( {
	        query : config.query,
	        templateRecord : this.templateRecord
	    }),
	    fields : exampleRecord.fields,
	    remoteSort : true
	}, config));
};

Ext.extend(cwe.navigation.GlobalSearchStore, Ext.data.Store);
