View Full Version : error on closing dialogs with combo box

30 Oct 2009, 8:31 AM
so far, this is an error I've experienced in every dialog wich holds a combo box and a button which calls the window.close() method

In the follow I post a fragment of sorce code.

Shortly describing the scenario:

the function which creates the dialog holds the definition of:

the Reader
the Combobox Store
a Combobox
a Button which calls the window.close() method.

So, when one selects a value in the combobox and thereafter press the Close button the system fires the combobox blur event which, for some reason (this's inside the ext-all library) try to access the combobox store which no longer exists, so an error fires out.
On the other side, if one closes the window using the system button (the X), the error doesn't happen, probably because, in this case, the combobox is not losing the focus.

I know, if I would put the store outside the function the error might non happen but I like to keep all the object definitions in the function which creates the dialog and destroy it...

I tried to use the window.suspendEvents() call, but for some reason, though it solves the blur issues, when the dialog is created back from subsequent calls it doesn't show out all of the components, not behaving correctly; I also tried to intercept the combobox blur event but it didn't work at all...

function gdDocSend(ids) {
if (!ids) {
var gdDocSendUserReader = new Ext.data.JsonReader({
root: 'root',
totalProperty: 'totalCounts',
id: 'ID',
fields: [{name: 'ID', type: 'int'}, 'NOMINATIVO']
var gdDocSendUserStore = new Ext.data.Store({
url: '/adon.pl',
autoLoad: true,
baseParams: {act: 'General', Mode: 'UserShortList', noadmin: 1},
reader: gdDocSendUserReader,
listeners: {
'load': {
fn: function() {
var combo = Ext.getCmp('gdDocSend_USER');
if (combo) {
var userCombo = new Ext.form.ComboBox({
id: 'gdDocSend_USER',
store: gdDocSendUserStore,
fieldLabel: 'Utente',
displayField: 'NOMINATIVO',
valueField: 'ID',
hiddenName: 'uid',
mode: 'local',
loadingText: 'Caricamento utenti...',
allowBlank: false,
blankText: 'occorre selezionare un utente cui inoltrare il documento',
emptyText:'Seleziona l\'utente cui inoltrare il documento',
width: 310,
editable: true,
disabled: true
var editPanel = new Ext.form.FormPanel({
collapsible: false,
fileUpload: false,
layout: 'form',
labelAlign: 'top',
autoWidth: true,
autoHeight: true,
bodyStyle: "padding: 10px; margin: 0px;",
border: false,
items: [userCombo,
xtype: 'hidden',
name: 'doc',
value: ids
xtype: 'hidden',
name: 'act',
value: 'GD'
xtype: 'hidden',
name: 'Mode',
value: 'DocSend'
var dlg = new Ext.Window({
title: 'Inoltra documento',
width: 350,
height: 150,
minWidth: 300,
minHeight: 150,
layout: 'fit',
manager: CONFIG._MODAL_EDIT ? modalWindowGroup : Ext.WindowMgr,
resizable: false,
maximizable: false,
closeAction: "close",
hideMode: "offsets",
constrainHeader: true,
autoScroll: true,
buttons: [{
xtype: 'button',
icon: iconPath + '/page_white_go.png',
id: 'gdDocSendButtonOK',
text: 'Inoltra',
tooltip: 'Inoltra',
disabled: false,
handler: function(){
url: '/adon.pl',
waitMsg: 'Operazione in corso...',
success: function(){
Ext.Msg.alert("Inoltra documento", "Operazione completata");
failure: function(me, action) {
Ext.Msg.alert("Errore: transazione fallita", "Tipo errore: " + action.failureType);
text: 'Chiudi',
handler: function() {
scope: this
items: [editPanel]
return dlg;

30 Oct 2009, 10:52 AM

1 Nov 2009, 11:47 PM
Sorry....I posted again a more readable versione of the code, though one doesn't really need to check the code above, the error happens in any dialog which holds the following features:

- the body of the function that defines the dialog it also defines: the reader, the store, a combobox attached to the former store (with mode: 'local'), a button which calls window.close method of the dialog

- when one clicks the combobox, choose an option and thereafter click the close button an error is thrown out, stating it's impossible to access the combobox store (because it's null or undefined)

2 Nov 2009, 12:41 AM
use closeAction: 'hide' and reuse your Window. Much more efficient.

2 Nov 2009, 3:00 AM
Thanks for the tip, I'll test it.

Though I'd like to know if there's a workaround for that bug that doesn't require to fit the application into a such different way of handling dialogs

2 Nov 2009, 4:01 AM

2 Nov 2009, 4:39 AM

22 Dec 2009, 10:05 AM
I realize that rewriting my code to use 'hide' may be more efficient, but it would also complicate my code.

But is there a fix for this that doesn't require me to do so?