Hi, I think there is a common theme on a few posts and I have tried a few ideas from previous posts on here, but still having no luck.
I have a grid, which loads an update form. On the form there is a combobox. Everything is working fine for create, remove etc. But for update, when the form pops up, the appropriate item for the current record is not selected in the combobox. In fact, when I click on the combo box, it appears that the loading of values from the database only happens on the click event - even though I have set lazyInit to false.
My combo is defined here:
SFSubsectors.combo.Sector = function(config) {
config = config || {};
Ext.applyIf(config,{
hiddenName: 'sectorid'
,displayField: 'sector'
,valueField: 'id'
,fields: ['id', 'sector']
,url: SFSubsectors.config.connectorUrl
,baseParams: { action: 'mgr/sfsector/getList' }
,editable: false
,lazyInit: false
});
SFSubsectors.combo.Sector.superclass.constructor.call(this,config);
};
Ext.extend(SFSubsectors.combo.Sector, MODx.combo.ComboBox);
Ext.reg('combo-sector', SFSubsectors.combo.Sector);
The update panel is defined as :
SFSubsectors.window.UpdateSFSubsector = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('sfsubsector_update')
,url: SFSubsectors.config.connectorUrl
,baseParams: {
action: 'mgr/sfsubsector/update'
}
,fields: [{
xtype: 'hidden'
,name: 'id'
},{
xtype: 'combo-sector'
,fieldLabel: _('sector')
,name: 'sectorid'
,width: 300
},{
xtype: 'textfield'
,fieldLabel: _('subsector')
,name: 'subsector'
,width: 300
}]
});
SFSubsectors.window.UpdateSFSubsector.superclass.constructor.call(this,config);
};
Ext.extend(SFSubsectors.window.UpdateSFSubsector,MODx.Window);
Ext.reg('sfsubsectors-window-sfsubsector-update',SFSubsectors.window.UpdateSFSubsector);
That panel is loaded into the grid using:
,updateSFSubsector: function(btn,e) {
if (!this.updateSFSubsectorWindow) {
this.updateSFSubsectorWindow = MODx.load({
xtype: 'sfsubsectors-window-sfsubsector-update'
,record: this.menu.record
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
this.updateSFSubsectorWindow.setValues(this.menu.record);
}
this.updateSFSubsectorWindow.show(e.target);
}
All help gratefully received.
Tim