2

I am trying to create a framework UI that creates container contents based on configs, and I get an error "TypeError: item.onAdded is not a function".

This does not happen in my smaller test app, but it does happen in our actual app. Can't figure out why.

Here is some partial code.

Ext.define('atlas.screen.Viewport', {
    extend: 'Ext.container.Viewport',
    alias: 'widget.atlas.Viewport',

    autoScroll: true,
    layout: 'fit',

    requires: [
        'base.framework.MainAppView',
        'base.framework.MainAppNavigation'
    ],

    items: [{
        // MainAppView requires providing config with items to populate the north,
        // west, and center regions.
        xtype: 'mainAppView',
        westItems: [{
            xtype: 'mainAppNavigation'
        }]
     }]
});

Ext.define('base.framework.MainAppView', {
    extend: 'Ext.container.Container',
    alias: 'widget.mainAppView',

    requires: ['base.util.CommonBaseUtil'],

    autoScroll: true,
    layout: 'border',

    westItems: null,

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [{
                xtype: 'container',
                itemId: 'appWestContainer',
                region: 'west',
                width: 85,
                items: me.westItems,
                hidden: true,
                listeners: {
                    afterrender: CommonBaseUtil.showHide
                }
            }]
        });
        me.callParent(arguments);
    },

    applyWestItems: function(westItems) {
        this.down('#appWestContainer').add(westItems);
    }
});

Ext.define('base.framework.MainAppNavigation', {
    extends: 'Ext.container.Container',

    alias: 'widget.mainAppNavigation',

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [{
                xtype: 'button',
                itemId: 'myButton',
                text: 'test'
            }]
        });
        me.callParent(arguments);
    }
});
1
  • Have you debugged in chrome or to see where .onAdded is being called? Commented May 20, 2014 at 20:41

1 Answer 1

15

It was one of my favorite BS ExtJS issues, "extends" VS "extend". You would think Sencha Cmd could catch this.

Sign up to request clarification or add additional context in comments.

2 Comments

What a pain, I'll never get that hour back!
I would upvote this 3 times if I could... un-be-lievable!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.