remove Listener`?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

remove Listener`?

smisonline2@googlemail.com
Hello,

i add some listeners like this

                 this.widgets["datum"].addListener("changeValue",  
function(e) {
                     this.loadShopData();
                     },this);

                 this.widgets["SHOPID"].addListener("changeSelection",  
function(e) {
                     this.loadUserData(this.USERID);
                     },this);

                 this.widgets["USERID"].addListener("changeSelection",  
function(e) {
                     this.loadTimelist();
                     },this);


nad when i laod new data, i want to deactivate/remove it.

i do this

this.widgets["datum"].removeListener("change",this.loadTimelist,this);
this.widgets["SHOPID"].removeListener("change",this.loadUserData,this);
this.widgets["USERID"].removeListener("change",this.loadTimelist,this);

or this

this.widgets["datum"].removeListener("changeValue",this.loadTimelist,this);
this.widgets["SHOPID"].removeListener("changeSelection",this.loadUserData,this);

this.widgets["USERID"].removeListener("changeSelection",this.loadTimelist,this);



but the listeners always active, what ist wrong?


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: remove Listener`?

Tristan Koch
Hi,

the function you add as listener is not the function you give when removing the listener. In fact, you pass an anonymous function to addListener.

Try:

this.widgets["datum"].addListener("changeValue", this.loadShopData, this);
this.widgets["datum"].removeListener("changeValue", this.loadShopData, this);

Another approach is to remember the id of the listener and use removeListenerById().

Regards
Tristan

Am 23.02.2012 um 12:34 schrieb [hidden email]:

> Hello,
>
> i add some listeners like this
>
>                 this.widgets["datum"].addListener("changeValue",  
> function(e) {
>                     this.loadShopData();
>                     },this);
>
>                 this.widgets["SHOPID"].addListener("changeSelection",  
> function(e) {
>                     this.loadUserData(this.USERID);
>                     },this);
>
>                 this.widgets["USERID"].addListener("changeSelection",  
> function(e) {
>                     this.loadTimelist();
>                     },this);
>
>
> nad when i laod new data, i want to deactivate/remove it.
>
> i do this
>
> this.widgets["datum"].removeListener("change",this.loadTimelist,this);
> this.widgets["SHOPID"].removeListener("change",this.loadUserData,this);
> this.widgets["USERID"].removeListener("change",this.loadTimelist,this);
>
> or this
>
> this.widgets["datum"].removeListener("changeValue",this.loadTimelist,this);
> this.widgets["SHOPID"].removeListener("changeSelection",this.loadUserData,this);
>
> this.widgets["USERID"].removeListener("changeSelection",this.loadTimelist,this);
>
>
>
> but the listeners always active, what ist wrong?
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: remove Listener`?

smisonline2@googlemail.com
hello,

what ist the id of the listener?

> Hi,
>
> the function you add as listener is not the function you give when removing the listener. In fact, you pass an anonymous function to addListener.
>
> Try:
>
> this.widgets["datum"].addListener("changeValue", this.loadShopData, this);
> this.widgets["datum"].removeListener("changeValue", this.loadShopData, this);
>
> Another approach is to remember the id of the listener and use removeListenerById().
>
> Regards
> Tristan
>
> Am 23.02.2012 um 12:34 schrieb [hidden email]:
>
>> Hello,
>>
>> i add some listeners like this
>>
>>                  this.widgets["datum"].addListener("changeValue",
>> function(e) {
>>                      this.loadShopData();
>>                      },this);
>>
>>                  this.widgets["SHOPID"].addListener("changeSelection",
>> function(e) {
>>                      this.loadUserData(this.USERID);
>>                      },this);
>>
>>                  this.widgets["USERID"].addListener("changeSelection",
>> function(e) {
>>                      this.loadTimelist();
>>                      },this);
>>
>>
>> nad when i laod new data, i want to deactivate/remove it.
>>
>> i do this
>>
>> this.widgets["datum"].removeListener("change",this.loadTimelist,this);
>> this.widgets["SHOPID"].removeListener("change",this.loadUserData,this);
>> this.widgets["USERID"].removeListener("change",this.loadTimelist,this);
>>
>> or this
>>
>> this.widgets["datum"].removeListener("changeValue",this.loadTimelist,this);
>> this.widgets["SHOPID"].removeListener("changeSelection",this.loadUserData,this);
>>
>> this.widgets["USERID"].removeListener("changeSelection",this.loadTimelist,this);
>>
>>
>>
>> but the listeners always active, what ist wrong?
>>
>>
>> ------------------------------------------------------------------------------
>> Virtualization&  Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
> ------------------------------------------------------------------------------
> Virtualization&  Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: remove Listener`?

Marc Puts


On 02/23/2012 01:11 PM, [hidden email] wrote:
> what ist the id of the listener?

The listener id is returned by the addListener function.

var listenerId = this.widgets["datum"].addListener("changeValue",
this.loadShopData, this);
this.widgets["datum"].removeListenerBy Id(listenerId);



------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: remove Listener`?

fritz
In reply to this post by smisonline2@googlemail.com
http://demo.qooxdoo.org/1.6.x/apiviewer/#qx.core.MEvents~addListener

Look at "Returns:"

Cheers,
Fritz

On Thu, 23 Feb 2012, [hidden email] wrote:

> hello,
>
> what ist the id of the listener?
>
>> Hi,
>>
>> the function you add as listener is not the function you give when removing the listener. In fact, you pass an anonymous function to addListener.
>>
>> Try:
>>
>> this.widgets["datum"].addListener("changeValue", this.loadShopData, this);
>> this.widgets["datum"].removeListener("changeValue", this.loadShopData, this);
>>
>> Another approach is to remember the id of the listener and use removeListenerById().
>>
>> Regards
>> Tristan
>>
>> Am 23.02.2012 um 12:34 schrieb [hidden email]:
>>
>>> Hello,
>>>
>>> i add some listeners like this
>>>
>>>                  this.widgets["datum"].addListener("changeValue",
>>> function(e) {
>>>                      this.loadShopData();
>>>                      },this);
>>>
>>>                  this.widgets["SHOPID"].addListener("changeSelection",
>>> function(e) {
>>>                      this.loadUserData(this.USERID);
>>>                      },this);
>>>
>>>                  this.widgets["USERID"].addListener("changeSelection",
>>> function(e) {
>>>                      this.loadTimelist();
>>>                      },this);
>>>
>>>
>>> nad when i laod new data, i want to deactivate/remove it.
>>>
>>> i do this
>>>
>>> this.widgets["datum"].removeListener("change",this.loadTimelist,this);
>>> this.widgets["SHOPID"].removeListener("change",this.loadUserData,this);
>>> this.widgets["USERID"].removeListener("change",this.loadTimelist,this);
>>>
>>> or this
>>>
>>> this.widgets["datum"].removeListener("changeValue",this.loadTimelist,this);
>>> this.widgets["SHOPID"].removeListener("changeSelection",this.loadUserData,this);
>>>
>>> this.widgets["USERID"].removeListener("changeSelection",this.loadTimelist,this);
>>>
>>>
>>>
>>> but the listeners always active, what ist wrong?
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Virtualization&  Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>> ------------------------------------------------------------------------------
>> Virtualization&  Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

--
Oetiker+Partner AG tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: remove Listener`?

smisonline2@googlemail.com
Hello,

i try  this


                 this.listeners["changeValue"] =
this.widgets["datum"].addListener("changeValue",  function(e) {
                     this.loadTimelist();
                     },this);

                 this.listeners["SHOPID"] =
this.widgets["SHOPID"].addListener("changeSelection",  function(e) {
                     this.loadTimelist();
                     },this);


and later this

                 if(this.listeners["datum_changeValue"]) {
                     
this.widgets["datum"].removeListenerById(this.listeners["datum_changeValue"]);
                     }
                 if(this.listeners["SHOPID_changeSelection"]) {
                     
this.widgets["SHOPID"].removeListenerById(this.listeners["SHOPID_changeSelection"]);
                     }
                 this.listeners = [];

but the events not destroyed


> http://demo.qooxdoo.org/1.6.x/apiviewer/#qx.core.MEvents~addListener
>
> Look at "Returns:"
>
> Cheers,
> Fritz
>
> On Thu, 23 Feb 2012, [hidden email] wrote:
>
>> hello,
>>
>> what ist the id of the listener?
>>
>>> Hi,
>>>
>>> the function you add as listener is not the function you give when removing the listener. In fact, you pass an anonymous function to addListener.
>>>
>>> Try:
>>>
>>> this.widgets["datum"].addListener("changeValue", this.loadShopData, this);
>>> this.widgets["datum"].removeListener("changeValue", this.loadShopData, this);
>>>
>>> Another approach is to remember the id of the listener and use removeListenerById().
>>>
>>> Regards
>>> Tristan
>>>
>>> Am 23.02.2012 um 12:34 schrieb [hidden email]:
>>>
>>>> Hello,
>>>>
>>>> i add some listeners like this
>>>>
>>>>                   this.widgets["datum"].addListener("changeValue",
>>>> function(e) {
>>>>                       this.loadShopData();
>>>>                       },this);
>>>>
>>>>                   this.widgets["SHOPID"].addListener("changeSelection",
>>>> function(e) {
>>>>                       this.loadUserData(this.USERID);
>>>>                       },this);
>>>>
>>>>                   this.widgets["USERID"].addListener("changeSelection",
>>>> function(e) {
>>>>                       this.loadTimelist();
>>>>                       },this);
>>>>
>>>>
>>>> nad when i laod new data, i want to deactivate/remove it.
>>>>
>>>> i do this
>>>>
>>>> this.widgets["datum"].removeListener("change",this.loadTimelist,this);
>>>> this.widgets["SHOPID"].removeListener("change",this.loadUserData,this);
>>>> this.widgets["USERID"].removeListener("change",this.loadTimelist,this);
>>>>
>>>> or this
>>>>
>>>> this.widgets["datum"].removeListener("changeValue",this.loadTimelist,this);
>>>> this.widgets["SHOPID"].removeListener("changeSelection",this.loadUserData,this);
>>>>
>>>> this.widgets["USERID"].removeListener("changeSelection",this.loadTimelist,this);
>>>>
>>>>
>>>>
>>>> but the listeners always active, what ist wrong?
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Virtualization&   Cloud Management Using Capacity Planning
>>>> Cloud computing makes use of virtualization - but cloud computing
>>>> also focuses on allowing computing to be delivered as a service.
>>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>>> _______________________________________________
>>>> qooxdoo-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>> ------------------------------------------------------------------------------
>>> Virtualization&   Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>> ------------------------------------------------------------------------------
>> Virtualization&  Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: remove Listener`?

Derrell Lipman
On Thu, Feb 23, 2012 at 07:44, [hidden email] <[hidden email]> wrote:
Hello,

i try  this


                this.listeners["changeValue"] =
this.widgets["datum"].addListener("changeValue",  function(e) {
                    this.loadTimelist();
                    },this);

                this.listeners["SHOPID"] =
this.widgets["SHOPID"].addListener("changeSelection",  function(e) {
                    this.loadTimelist();
                    },this);


and later this

                if(this.listeners["datum_changeValue"]) {

this.widgets["datum"].removeListenerById(this.listeners["datum_changeValue"]);
                    }
                if(this.listeners["SHOPID_changeSelection"]) {

this.widgets["SHOPID"].removeListenerById(this.listeners["SHOPID_changeSelection"]);
                    }
                this.listeners = [];

but the events not destroyed

You assign the listener id to this.listeners["changeValue"] but you then remove the listener with id this.listeners["datum_changeValue"]. It would probably work better if you removed a listener with a defined id.



------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel