views:

11

answers:

1

So the code below is called when a user selects Save on an ExtJS popup modal window. This window ONLY contains a combobox. Now, sometimes when a user saves this, and then re-opens it later on, the combobox will appear BEHIND the window all grayed out, unable to get to. Other times, it will be fine and work, and no difference in events happening either time, just complete utter inconsistency.

Does anyone know what this could be?

var changeProductOK = function() {
            var win = getChangeProductWindow();
            if (win.subProductId.getValue() == '') {
                Global.alert('Choose a product');
                return;
            }
            win.hide();
            PropertiesWin.hide();

            Global.confirm('You sure?', 'Confirm', function(result) {
                if (result) {
                    Global.mask('Changing the product', workspacePanel.getEl());
                    WorkspaceController.ChangeProduct(applicationId, win.subProductId.getValue(), function(response) {
                        Global.unmask(workspacePanel.getEl());

                        if (!response) {
                            showWorkflowMessages([{ Type: 0, Text: 'A timeout occurred while changing the product.  Please try again.'}]);
                            return;
                        }
                        if (response.Data.Result == false) {
                            showWorkflowMessages(response.Data.Messages);
                        } else {
                            Global.mask('Reloading the application');
                            reloadWorkspace();
                        }
                    });
                }
                win.subProductId.setValue('');
            });
        }
A: 

I'm answering for how I get around this, but feel free to post other answers before it lets me accept this one if you know of a common way to prevent this from happening.

I placed

win.close();

right after

win.subProductId.setValue('');

That way it destroys the modal everytime a successful save completes and therefore it will always load up as the initial window (which worked everytime)

Scott