PDA

View Full Version : Combobox selection cause popup window to close (why?)



billmcknight
16 Jun 2012, 5:57 PM
I have a pop-up window (Ext.window.Window) with a form on it. Within the form are two comboboxes. When a selection is made in either of the comboboxes, the pop-up window disappears. The form data is not submitted, however. I don't want the combobox selection to cause this "closing" of the popup. Is there a setting in thru Sencha Architect that prevents this behavior.

evant
16 Jun 2012, 9:11 PM
Impossible to say without seeing any code, certainly not normal behaviour.

billmcknight
17 Jun 2012, 6:08 AM
Here is the main code (starting with Ext.define...), which is mostly generated by Architect, but some of my settings are probably suspect. I'm new to Sencha Architect and EXTJS (1 week). Also the Ext.window is launched by this editSiteInfo function (in bold) on a double click on a grid:

editSiteInfo: function(grid, record) {
var view = Ext.widget('EditSite');
var frm = view.down('form');


frm.loadRecord(record);
var cmbStates = view.down('#cmbStates');
cmbStates.setValue(record.data.State);
var cmbCountries = view.down('#cmbCountries');
cmbCountries.setValue(record.data.Country);

Ext.define('MyApp.view.EditSite', {
extend: 'Ext.window.Window',
alias: 'widget.EditSite',


autoRender: false,
autoShow: true,
height: 226,
id: 'EditSite',
width: 372,
title: 'Edit Site Info',


initComponent: function() {
var me = this;


Ext.applyIf(me, {
dockedItems: [
{
xtype: 'form',
dock: 'top',
items: [
{
xtype: 'textfield',
id: 'Sitename',
width: 350,
name: 'Sitename',
fieldLabel: 'Sitename',
labelAlign: 'right'
},
{
xtype: 'textfield',
id: 'Address',
width: 350,
name: 'Address',
fieldLabel: 'Address',
labelAlign: 'right'
},
{
xtype: 'textfield',
id: 'City',
width: 350,
name: 'city',
fieldLabel: 'City',
labelAlign: 'right'
},
{
xtype: 'combobox',
autoShow: true,
id: 'cmbStates',
width: 350,
name: 'cmbStates',
fieldLabel: 'State',
labelAlign: 'right',
displayField: 'name',
store: 'StateStore',
typeAhead: true,
valueField: 'abbr'
},
{
xtype: 'textfield',
id: 'PostalCode',
width: 350,
name: 'postalcode',
fieldLabel: 'Postal code',
labelAlign: 'right'
},
{
xtype: 'combobox',
autoShow: true,
id: 'cmbCountries',
width: 350,
name: 'cmbCountries',
fieldLabel: 'Country',
labelAlign: 'right',
displayField: 'name',
queryMode: 'local',
store: 'CountryStore',
typeAhead: true,
valueField: 'country'
}
],
dockedItems: [
{
xtype: 'toolbar',
border: '3 3 3 3 ',
autoDestroy: false,
dock: 'bottom',
layout: {
pack: 'end',
type: 'hbox'
},
items: [
{
xtype: 'button',
handler: function(button, event) {
var form = me.down('form').getForm();
var data = form.getValues();
form.submit({url: 'OData/UpdateSiteInfo/' + data ,
submitEmptyText: false,
waitMsg: 'Saving Data...'});
me.close();
},
height: 25,
id: 'btnSave',
width: 50,
text: 'Save'
},
{
xtype: 'button',
handler: function(button, event) {
me.close();
},
height: 25,
id: 'btnCancel',
width: 50,
text: 'Cancel'
},
{
xtype: 'hiddenfield',
id: 'SiteId',
name: 'SiteId',
fieldLabel: 'Label'
}
]
}
]
}
]
});


me.callParent(arguments);
}

For what it is worth, it seems the ComboBoxes are re-loading data from their stores when selected.

Animal
17 Jun 2012, 10:57 AM
Try removing autoShow: true

I just fixed a bug with that. I think it will be rendering that Component which is a Very Bad Thing.

billmcknight
17 Jun 2012, 1:59 PM
Unfortunately, removing the autoshow did not fix anything. Of course to see the popup window I had to change the code that launches the window using the show() method. Is there some other method I should be using to launch theis popup window?