Nick Div
Nick Div

Reputation: 5628

initialize: is not working in the production build

xtype: 'component',
                        cls: 'headerComponent',
                        id: 'RequirementHeader' + i,
                        itemId: 'requirementHeaderViewID-' + i,
                        html: arrReqTplHeader,
                        constructor: function (config) {
                            var me = this,
                                currentConfig = me.config;
                            me.fireEvent('initialize', me);
                        },
                        initialize: function (obj) {
                            var me = this;
                            me.element.down('img').on('tap', me.imageTap, this, me);                            
                        }, imageTap: function (obj) {
                        alert("it doest reach here");
                        }

I have this component in sencha touch that works fine when I am using it on testing environment, but as soon as I build the project it does not call the initialize function in the build version, Can someone please help me with this. I have tried googling the issue already but of no use.

Upvotes: 2

Views: 380

Answers (1)

Darin Kolev
Darin Kolev

Reputation: 3411

Don't forget to call the parent method when you override initialize:

initialize: function (obj) {
    var me = this;
    me.callParent(arguments); 
    me.element.down('img').on('tap', me.imageTap, this, me);
}

And I think in this case you don't need the constructor, because initialize is always called.

Upvotes: 1

Related Questions