Results 1 to 5 of 5

Thread: Override doesn't work

  1. #1
    Sencha User
    Join Date
    Jul 2016
    Posts
    38
    Answers
    1

    Default Override doesn't work

    My override function doesn't work for the specific class:

    Code:
    Ext.override(Ext.container.DockingContainer,
        {
            getDockedItems: function (selector, beforeBody) {
                var layout = this.getComponentLayout();
    
    
                if (typeof layout.getDockedItems === "function") {
                    var dockedItems = layout.getDockedItems('render', beforeBody);
    
    
                    if (selector && dockedItems.length) {
                        dockedItems = Ext.ComponentQuery.query(selector, dockedItems);
                    }
                    return dockedItems;
                }
    
    
                return [];
            }
        });
    In the same file there are another override functions,they are working properly. But not for DockingContainer class.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Is this override code getting accessed when you run your test?

  3. #3
    Sencha User
    Join Date
    Jul 2016
    Posts
    38
    Answers
    1

    Default

    Nope. Original function is executing, but not overrided.

    I see that during the first execution of javascript code, Ext.base.addMembers function overrides it. But Ext.container.DockingContainer.getDockingRefItems calls original version. Here is the stack trace, where we can see how we get that:

    getDockedItems (VM1511 ext.axd:90229)
    getDockingRefItems (VM1511 ext.axd:90239)
    getRefItems (VM1511 ext.axd:91421)
    getRefItems (VM1511 ext.axd:77855)
    callParent (VM1511 ext.axd:7739)
    getRefItems (VM1511 ext.axd:91420)
    getItems (VM1511 ext.axd:15495)
    _execute (VM1511 ext.axd:15753)
    execute (VM1511 ext.axd:15714)
    query (VM1511 ext.axd:15935)
    query (VM1511 ext.axd:65056)
    down (VM1511 ext.axd:65099)
    activate (NaviWindow.js:89)
    fire (VM1511 ext.axd:12227)
    doFireEvent (VM1511 ext.axd:12769)
    Ext.define.monitor.prototype.doFireEvent (VM1511 ext.axd:33897)
    fireEventArgs (VM1511 ext.axd:12739)
    fireEvent (VM1511 ext.axd:12713)
    setActive (VM1511 ext.axd:37085)
    onCollectionSort (VM1511 ext.axd:77169)
    notify (VM1511 ext.axd:44551)
    sortItems (VM1511 ext.axd:44707)
    onSortChange (VM1511 ext.axd:44675)
    onEndUpdateSorters (VM1511 ext.axd:44816)
    fire (VM1511 ext.axd:12227)
    doFireEvent (VM1511 ext.axd:12769)
    fireEventArgs (VM1511 ext.axd:12739)
    notify (VM1511 ext.axd:44564)
    endUpdate (VM1511 ext.axd:43466)
    addSort (VM1511 ext.axd:53662)
    sort (VM1511 ext.axd:44681)
    onComponentUpdate (VM1511 ext.axd:77185)
    updateActiveCounter (VM1511 ext.axd:37046)
    setter (VM1511 ext.axd:6611)
    bringToFront (VM1511 ext.axd:77245)
    toFront (VM1511 ext.axd:37061)
    onFloatShow (VM1511 ext.axd:37116)
    onShowComplete (VM1511 ext.axd:41118)
    afterShow (VM1511 ext.axd:39940)
    show (VM1511 ext.axd:41625)
    fn (App.js:529)
    processBinding (VM1511 ext.axd:81085)
    handleTargetEvent (VM1511 ext.axd:81056)
    fire (VM1511 ext.axd:12227)
    fire (VM1511 ext.axd:19071)
    publish (VM1511 ext.axd:19047)
    doDelegatedEvent (VM1511 ext.axd:19097)
    onDelegatedEvent (VM1511 ext.axd:19084)
    (anonymous) (VM1511 ext.axd:4686)

  4. #4
    Sencha User
    Join Date
    Jul 2016
    Posts
    38
    Answers
    1

    Default

    When do mixins be initialized? Only one time at the start of application or in every panel creating?

    The sequence:

    1. Ext.define('Ext.container.DockingContainer',
    2. Ext.define('Ext.panel.Panel',
    3. Ext.override(Ext.container.DockingContainer

    Will mixin DockingContainer be created when defining Panel?

  5. #5
    Sencha User
    Join Date
    Jul 2016
    Posts
    38
    Answers
    1

    Default

    Code:
    Ext.define('Ext.override.container.DockingContainer',
        {
            override: 'Ext.container.DockingContainer',
            getDockedItems: function (selector, beforeBody) {
                console.log('Is this a good idea???')
            }
        },function(){
            Ext.Object.each(Ext.ClassManager.classes,function(name, cls){
                if(cls.prototype && cls.prototype.mixins && cls.prototype.mixins.hasOwnProperty('docking')){
                    cls.prototype.getDockedItems =this.prototype.getDockedItems;
                }
            },this);
        });

Similar Threads

  1. [CLOSED]Override doesn't work with singletons
    By firefoxSafari in forum Ext:Bugs
    Replies: 3
    Last Post: 21 Mar 2013, 7:06 AM
  2. Ext.override doesn't always work on all cases.
    By jaycode in forum Ext: Q&A
    Replies: 1
    Last Post: 5 Jul 2012, 11:03 AM
  3. [CLOSED] Ext.define override doesn't work
    By gastaldelloa in forum Sencha Touch 2.x: Bugs
    Replies: 2
    Last Post: 7 Mar 2012, 5:26 AM
  4. [4.1b1]Ext.override doesn't work correctly
    By kof720551 in forum Ext: 4.x Beta
    Replies: 1
    Last Post: 16 Jan 2012, 8:58 AM
  5. Override an extended extension doesn't work
    By Dr. Flink in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 16 Oct 2008, 5:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •