PDA

View Full Version : Update xtype after ComboBox select



Anasota
5 Jun 2013, 12:43 PM
Hello,

I have a Combobox and a Container. What I want to do is to call URL based on combobox user select value

here is the code


{
xtype: 'combobox',
id: 'userlist',
name : 'user_id',
allowBlank: false,
fieldLabel: 'Assigned User',
store: new Mc.store.Users(),
listeners: {
afterrender: {
scope: this,
fn: function(_this) {
if (this.data != null) {
var store = _this.store;
var filters = [{
field: 'group_id'
,data: {
type: 'int'
,value: 5
}
}];
store.clearFilter();
store.getProxy().extraParams = {
filter: Ext.JSON.encode(filters)
};
store.clearFilter();
store.load();

}
}
},
select: function(combo) {

// what here ?

}




},
displayField: 'namdanddesc',
valueField: 'id',
editable: false,
queryMode: 'local'
}
,
{
xtype: 'container',
id: 'userimg',
loader: {
url: './users/getIMG/',
autoLoad: true
}
}

the idea is to call the php page every time selection is changed and show picture..
please note that this is under MVC environment.

Please help, I'm stuck on this one!

Thanks..

glopes
5 Jun 2013, 2:04 PM
Container Changes:
remove the url and set the autoLoad to false;

Combo changes:


select: function(combo){
if(combo.getValue()) {
Ext.getCmp('userimg').getLoader().load({
url: 'users/getIMG/' + combo.getValue()
});
}
}