Results 1 to 3 of 3

Thread: Initialize function not firing in built version ( working in development version )

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    2

    Default Answered: Initialize function not firing in built version ( working in development version )

    Hi,

    I have the following code in my application and it works fine in the development environment but then when I build the app the initialize function or the on tap event doesn't fire anymore. The component still renders properly but the initialize function or the on tap event never work. Any help or ideas would be greatly appreciated.


    Code:
             
          this.categorystore.each(function (item, index, length) {
                  var el = Ext.create('Ext.Component', {                
                     initialize: function() {
                        this.element.on({
                            tap: function(event, element, object, action) {
                                                        ....
    
                            }
                        });
                    },
                    html: item.get('name'),
               });
        });

  2. You can only use the initialize method when defining a new class using Ext.define.

    What you want to do is this:

    Code:
    Ext.create('Ext.Component', {
        html      : item.get('name'),
        listeners : {
            element : 'element',
            tap     : function(event, target) {}
        }
    });

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    You can only use the initialize method when defining a new class using Ext.define.

    What you want to do is this:

    Code:
    Ext.create('Ext.Component', {
        html      : item.get('name'),
        listeners : {
            element : 'element',
            tap     : function(event, target) {}
        }
    });
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    2

    Default

    Awsome, it worked, thanks a lot!!

    Weird that it works in the development version though.

Posting Permissions

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