How "dojo.connect" be modified to call 2 functions with on-click event

144 Views Asked by At

I want to call 2 functions on a click event. I tried the below way but it didn't help, basically I would like to call get and refresh on click

dojo.connect(this.next, "onclick", "get");  
dojo.connect(this.next, "onclick", "refresh");

one way is to call a function which inturn calls get and refresh. But how do I achieve this....

1

There are 1 best solutions below

0
Bourbia Brahim On BEST ANSWER

Simply use function that call both get and refresh as below :

dojo.connect(this.next, "onclick", function(e) {
   get(e);
   refresh(e);
});

if you're using dojo >= 1.7 , you better use dojo/on for handling events,

your code would become : ( after importing "dojo/on" )

on(this.next, "click", function(e){
   get(e);
   refresh(e);
});