var ComboTree = function(config){
	var th = this;
	
	this.targetEx = config.targetEx;

	ComboTree.superclass.constructor.call(this, this.config);
	this.store = new Ext.data.Store({
		url: 'actions/cour.get.json.php',
		reader: new Ext.data.JsonReader({}, [{name: 'id'}, {name: 'name'}]),
		listeners: {
			loadexception: function(httpProxy, dataObject, arguments, exception){
            	dd(exception);
			}
		}
	});	
}

Ext.extend(ComboTree, Ext.form.ComboBox, {
    fieldLabel: 'Изменить курс',
    mode: 'remote',
    readOnly: true,
    displayField: 'name',
    valueField: 'id',
    triggerAction: 'all',         
    emptyText: 'Выберите курс...',    
    forceSelection: false,                           
    queryDelay: 50,
    width:135,
    listeners: {
        change: function(combo, newValue, oldValue){
        },

        select: function(combo, record, index){
        	this.targetEx.reloadEx(record.data.id);
        	//this.targetEx.setTitle(record.data.name);
        	this.targetEx.getRootNode().setText(record.data.name);
        }
    }
});
