1. #1
    Ext JS Premium Member
    Join Date
    Jun 2009
    Location
    Eastern WA, US
    Posts
    78
    Vote Rating
    0
    jnicora is on a distinguished road

      0  

    Default Answered: Ext equivalent to the jQuery method .live()

    Answered: Ext equivalent to the jQuery method .live()


    Does such a thing exist or will I need to roll my own?

    http://api.jquery.com/live/

    Description: Attach an event handler for all elements which match the current selector, now and in the future.

  2. You achieve it by using the delegate option:

    http://docs.sencha.com/ext-js/4-1/#!...od-addListener

    Code:
    Ext.getBody().on('click', function(){
        console.log('You clicked foo');
    }, null, {
        delegate: '.foo'
    });

  3. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,784
    Answers
    450
    Vote Rating
    599
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You achieve it by using the delegate option:

    http://docs.sencha.com/ext-js/4-1/#!...od-addListener

    Code:
    Ext.getBody().on('click', function(){
        console.log('You clicked foo');
    }, null, {
        delegate: '.foo'
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  4. #3
    Ext JS Premium Member
    Join Date
    Jun 2009
    Location
    Eastern WA, US
    Posts
    78
    Vote Rating
    0
    jnicora is on a distinguished road

      0  

    Default


    Had not seen the delegate argument, that is perfect - thanks!

  5. #4
    Ext JS Premium Member
    Join Date
    Jun 2009
    Location
    Eastern WA, US
    Posts
    78
    Vote Rating
    0
    jnicora is on a distinguished road

      0  

    Default


    Actually, one more quick question - delegate refers to a DOM selector, is there an option or a way to have delegate use ComponentQuery instead?

    It would be easy enough to bake that myself, just asking if it's already built in.

  6. #5
    Ext JS Premium Member
    Join Date
    Jun 2009
    Location
    Eastern WA, US
    Posts
    78
    Vote Rating
    0
    jnicora is on a distinguished road

      0  

    Default


    Is this alos a viable solution?

    Code:
    	        	Ext.util.Observable.observe(Ext.util.Observable);
    	        	
    	        	Ext.util.Observable.on('click', function(context, event, options) {
    		        	// intercept here
    	        	});

  7. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,784
    Answers
    450
    Vote Rating
    599
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    The equivalent to live would be the controller in the MVC structure.

    Otherwise, you could instantiate the EventBus yourself.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #7
    Ext JS Premium Member
    Join Date
    Jun 2009
    Location
    Eastern WA, US
    Posts
    78
    Vote Rating
    0
    jnicora is on a distinguished road

      0  

    Default


    Is it possible to have a controller intercept an event? Making assumptions here, but I'm guessing the controller uses event delegation to bind listeners, which means a buttons "handler" will fire first, then the event will bubble up to the body and then call the appropriate delegate, the problem is that I need to fire my override first, then possibly stop propagation.

    So far the best way I have found to do this is to observe a class, like "Ext.form.Basic" or "Ext.util.Observable" and listen to their events, like "actioncomplete" or "click" - this lets me run an override first then either cancel propagation or not.

    I certainly didn't explain myself properly in my original post and I'm not entirely sure I am now.

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..."