View Full Version : Undefined fields'ownerCt inside deferred calls

Dmitry Ovsianko
25 Jul 2011, 11:37 AM

Ext version tested:

Ext 4.02

Browser versions tested against:

Chrome 12.0.742.122 for Windows


When executing Ext.form.Basic.submit(), its field's ownerCts appear undefined, wich lead to js errors.

Steps to reproduce the problem:

Take the MVC demo described in ExtJs 4.0.2 docs;
Redefine the updateUser handler so that it calls submit() directly (see the code below);
Open the edit form and press the "Save" button

The result that was expected:

A valid HTTP request to the required URL

The result that occurs instead:

Uncaught TypeError: Cannot read property 'id' of undefined at HashMap.js:134

Test Case:

updateUser: function(button) {
var win = button.up('window');
win.down('form').getForm().submit ({
url: '/',
success: function(form, action) {},
failure: function(form, action) {}


Debugging already done:

when iterating over getFields() in batchLayouts, the fields seem OK but their ownerCt are undefined which lead to the actual error;
every getFields() iteration sees undefined ownerCt when called inside Ext.defer(). Without deferring, ownerCt are defined.
replacing "Ext.defer(action.run, 100, action)" with just "action.run()" in Ext.form.Basic.doAction() seem to fix the problem.

Possible fix:

maybe it worth to avoid Ext.defer in Ext.form.Basic.doAction?

Additional CSS used:

only default ext-all.css

Operating System:

WinXP Pro (5.1.2600)

2 Aug 2011, 4:30 AM
In window declaration write
closeAction: 'close' and all will be good! :)

Dmitry Ovsianko
16 Aug 2011, 1:55 AM
Thank you, this worked out, but had a stack overflow as side effect.

closeAction: 'hide' seems to be the right solution.

15 Sep 2011, 1:01 AM
any fix to this issue, I get the error on both actions: "destroy" and "hide"

15 Sep 2011, 1:22 AM
was using closeAction: 'hide' to form.Panel instead off window, now is for window and works. But I don't want to hide it, why "destroy" throws :

Uncaught TypeError: Cannot read property 'id' of undefined

26 Mar 2012, 3:06 AM
it's good error)))
you can not close window until submit() not done!
use code like this

in controller

doFilter: function() {
var wnd = this.getWindowFilter();
var formFilter = wnd.down('form');
if (formFilter.getForm().isValid()) {
scope: this,
method: 'POST',
url: './store/filter/setFilter.php',
success: function(form, action) {
var wnd = this.getWindowFilter();
//Ext.Msg.alert('Debug', 'Success');
failure: function(form, action) {}