You found a bug! We've classified it as EXTJS-15210 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    20
    Vote Rating
    0
    tonvoon is on a distinguished road

      0  

    Default ExtJS 4.2.3: console error 'undefined is not a function' when querying objects

    Hi,

    We had a problem in our application when using itemselectors which did not exist in ExtJS 4.2.1, but did when we upgraded to ExtJS 4.2.3. The attached image shows the error when our code made a this.query('#itemId') within a window file.

    A lots of debugging shows that a "true" was being returned as a component, thus causing line 23008 in ext-all-debug.js from failing:
    Code:
    if (candidate.getItemId() === id) {
    It turns out that getRefItems() in Ext.view.BoundList was returning a true item incorrectly. This is the override we added:

    Code:
    Ext.require('Ext.view.BoundList', function() {
        Ext.override(Ext.view.BoundList, {
            getRefItems: function() {
                var me = this,
                    result = [];
    
    
                if (me.pagingToolbar) {
                    result.push(me.pagingToolbar);
                }
                if (Ext.isObject(me.loadMask)) {
                    result.push(me.loadMask);
                }
                return result;
            }
        });
    });
    As ExtJS docs says loadMask could be true or false, the Ext.isObject() confirms that only objects are added to the list of items to check in query().

    This appears to fix all our query() issues.

    Can you confirm if this is a bug and if this is a valid fix.

    Ton
    Attached Images

  2. #2
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    6,690
    Vote Rating
    179
    Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold

      0  

    Default

    Thanks for the report. It sounds like this issue:
    http://www.sencha.com/forum/showthread.php?297907

    That override looks good, but you might want to use the more modern override style:
    Code:
    Ext.define('Ext.view.override.BoundList', {
        override: 'Ext.view.BoundList',
    You might also want to check me.loadMask before checking if it is an object.
    Code:
    if (me.loadMask && Ext.isObject(me.loadMask)) {
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    20
    Vote Rating
    0
    tonvoon is on a distinguished road

      0  

    Default

    Gary,Thanks for the verification and the hints. I'll add a link in the other post to here.Ton

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    31
    Vote Rating
    2
    vot is on a distinguished road

      0  

    Default

    Still not fixed in 4.2.4 (20150714) :-(

  5. #5
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    20
    Vote Rating
    0
    tonvoon is on a distinguished road

      0  

    Default

    Gary,Can this defect be fixed in a future release? We've been running with this override without any issues for a few months.Ton

  6. #6
    Sencha Premium Member
    Join Date
    Jul 2009
    Posts
    31
    Vote Rating
    2
    vot is on a distinguished road

      0  

    Default

    To me this is a regression in 4.2.3. In 4.2.2 it works because the errorneus code has been introduced in 4.2.3. The override works for me, too. If you check the code it does not make sense to return the loadMask if it is not an object. This happens everytime when getRefItems is called and the component was not rendered until then. The loadMask is created in the onRender method as far as i remember.

    Code:
    Ext.define('Ext.view.override.BoundList', {
        override: 'Ext.view.BoundList',
    
    
        getRefItems: function() {
            var me = this, result = [];
            if (me.pagingToolbar) {
                result.push(me.pagingToolbar);
            }
            if (me.loadMask && Ext.isObject(me.loadMask)) {
                result.push(me.loadMask);
            }
            return result;
        }
    });
    Maybe the code has to be removed because i did not find this in 5.1.1 for example.

  7. #7
    Sencha - Support Team
    Join Date
    Feb 2013
    Location
    California
    Posts
    6,690
    Vote Rating
    179
    Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold Gary Schlosberg is a splendid one to behold

      0  

    Default

    I've marked the bug a regression, which should get it better priority with our developers.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

Similar Threads

  1. How the Chrome console marks objects
    By mx_starter in forum Ext 5: Q&A
    Replies: 1
    Last Post: 15 Jan 2015, 8:50 AM
  2. Replies: 1
    Last Post: 15 Jan 2012, 4:40 PM
  3. Error: [undefined] is not a function
    By JeaffreyGilbert in forum Sencha Touch 1.x: Q&A
    Replies: 1
    Last Post: 22 Nov 2011, 11:20 AM
  4. extjs throws string objects instead of error objects
    By bmf1972 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 22 Apr 2008, 3:14 AM

Thread Participants: 2