Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

Hybrid View

  1. #1
    Ext User
    Join Date
    Mar 2008
    Posts
    90
    Vote Rating
    0
    J.B is on a distinguished road

      0  

    Default Listeners and Scope

    Listeners and Scope


    Hi All,

    I am trying to fire an event in my JS file to a listener rendered by lazy-initialization code, but the two don't want to talk to each other. Do I need to define a specific scope? They are both rendered on the same page..

    JS
    Code:
    	this.addEvents({'checkactive': true});
    
            .....
    
    	this.grid.on('rowclick',  function(grid, index, e) {		
    		if (sm.getCount() > 0) {
    			this.fireEvent('checkactive', 'enabled');						
    		} else { 
    			this.fireEvent('checkactive', 'disabled');						
    		}
    	}, this);
    In my JSON lazy initialization code:

    Code:
    	buttons: [{
    		"text": "Submit",
    		"type": "button",
    		"scope": this,
    		"handler": function(){ submit(); },
    		"listeners": {
    	  			 "checkactive": function(isenabled) {
    						alert(isenabled);				
    				},
    				scope:this
    		}
               .....
    I've checked in FireBug and the fireEvent is run, but the listener never gets executed.

    Any ideas?

    Thanks

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      1  

    Default


    this.grid.on('rowclick'....

    You bind that handler function to whatever "this" is at that time. That is then what the 'checkactive' event is fire on.

  3. #3
    Ext User
    Join Date
    Mar 2008
    Posts
    90
    Vote Rating
    0
    J.B is on a distinguished road

      0  

    Default


    Thanks Animal, what could it be binded to other than 'this'? I am not familiar with using different scoping definitions...

    Thanks again

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    If you don't need it, don't use it.

    But if you are writing "function soup" rather than a set of discrete Classes which manage their own internal state individually, then you are storing up trouble.

  5. #5
    Ext User
    Join Date
    Mar 2008
    Posts
    90
    Vote Rating
    0
    J.B is on a distinguished road

      0  

    Default


    Thanks. I'm assuming by removing the scope on an event it would work across the dom of the active page? That would solve the problem I am having.

    I have removed the scrope from the listener but how can I make the event global, currently this.fireEvent.... still does not execute the listener which is without scope.

    Thanks

    John

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Code:
    this.grid.on('rowclick',  function(grid, index, e) {		
    		if (sm.getCount() > 0) {
    			this.fireEvent('checkactive', 'enabled');						
    		} else { 
    			this.fireEvent('checkactive', 'disabled');						
    		}
    	}, this)
    The things in red are the same. You have specified a rowclick handler to run, and passed this as the scope. So that is what the this in the handler will be.

Thread Participants: 2