PDA

View Full Version : listener with two function call in ExtJs 4.2



Programmers
4 Mar 2014, 4:56 PM
hi community,

I would like to call a FormField in the listener two separate functions


example

{id:'suchFeld08',
fieldLabel:'Umsatz bis' ,
labelWidth:66,
width:164,
height:25,
maxLength: 7,
x:661,
y:63,
listeners: tastaturFilter( 0, 1, 0, 0), function2()
}

Maybe someone can tell me how this could work

by programmers

mdnaveed42
4 Mar 2014, 9:19 PM
Hi,

Sencha Docs: A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Observable-method-addListener) example for attaching multiple handlers at once.

More info: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Observable-cfg-listeners


Thanks,
Md Naveed
\m/

Programmers
4 Mar 2014, 11:49 PM
@ mdnaveed42

went through the docs yesterday and did not even
found something approaching what brings me further
First, I check the docs before I post here.

I have the problem that I have no two insic

as click and dblclick

just both functions to be called one after the other.

by programmers

chramer
5 Mar 2014, 12:49 AM
you mean this?


listeners: {
'click': function () {
this.function1();
this.function2();
},
scope: this
}

Programmers
5 Mar 2014, 6:30 AM
you mean this?


listeners: {
'click': function () {
this.function1();
this.function2();
},
scope: this
}


in about...Yes... only without event
It just two quite normal to be called functionen.





listeners: function1(); function2();

/* OR */

listeners:{function1();function2();}




How can I call functionen in the listeners two

programmers

chramer
5 Mar 2014, 6:52 AM
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Observable-cfg-listeners
The 'listeners' config it's an object. In Javascript an object is a collection of key-value pairs.
So it should look like this:


listeners: {
'event1Name': function() {
/*to be executed when event1Name is fired*/
},
'event2Name': function() {
/*to be executed when event2Name is fired*/
}
}


Explain what you want to achieve..

NoahK17
7 Dec 2017, 1:23 PM
He wants event1Name and event2Name to be the same. He wants to execute two DIFFERENT functions with one 'tap'.