1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    43
    Vote Rating
    1
    farbodr is on a distinguished road

      0  

    Default Where is best place to implement listeners

    Where is best place to implement listeners


    I don't directly instantiate my panels. Right now I use 'xtype' in the items config and this automatically instantiates the right classes. Since it is not recommended to implement the listeners in the 'Ext.define' where is a good place to put the listeners when using xtype in items config?

    TIA,
    FR

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    555
    Vote Rating
    24
    estesbubba will become famous soon enough estesbubba will become famous soon enough

      0  

    Default


    It really depends on what the listener needs to do. If you click a button and need to submit a form then use control {} in the controller. If you click a checkbox and need to disable some fields then your view can handle the listener internally. Sometimes custom events make more sense - like have your view listen for a button click and fire a custom event like fireEvent('unregisterUser').

    I think what the framework wants you to avoid is doing something like this in your controller.

    Code:
    Ext.create('App.view.MyView', {
        ...
        listeners: {}
    });
    The above is for view events. The other type of events we use a lot are application events (controller to controller for example). We put these in init() in the controller.

    Code:
        init: function() {
            var me = this;
    
    
            me.getApplication().on({
                showPayment: me.show,
                scope: me
            });
        },

  3. #3
    Sencha User
    Join Date
    Jul 2010
    Posts
    43
    Vote Rating
    1
    farbodr is on a distinguished road

      0  

    Default


    Thanks for your reply. Since I am not directly instantiating the class I'm still not sure where to put the listeners. For instance I'd like to do something in the painted event or a tap event.

  4. #4
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    555
    Vote Rating
    24
    estesbubba will become famous soon enough estesbubba will become famous soon enough

      0  

    Default


    Doesn't matter if you use Ext.create or xtype. Add your listener to control {} and it will pick it up.

  5. #5
    Sencha User
    Join Date
    Jul 2010
    Posts
    43
    Vote Rating
    1
    farbodr is on a distinguished road

      0  

    Default


    ok. thanks.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi