PDA

View Full Version : Event with multiple function in MVC



lucrativeu
20 Feb 2013, 1:54 AM
Hi,
Can an event have more than one function? for instance, a grid with an itemClick event, is it possible to do something like this: itemClick: taskSelected, taskClicked, where taskSelected and taskClicked are functions in the controller.
Your suggestion will be highly appreciated, thanks.

scottmartin
20 Feb 2013, 5:20 AM
Not sure I understand .. you can have:



'user-list' : {
itemclick : me.viewUser,
itemdblclick : me.editUser
}


Or you can call another function inside of the called function



viewUser : function () {
me.editUser();
}


Scott

lucrativeu
20 Feb 2013, 7:43 AM
Thanks scott for your quick response. The question is, can an event have more than one functions, something like itemClick :me.viewUser();me.editUser()

scottmartin
20 Feb 2013, 8:52 AM
You would have to create a wrapper/helper function that calls both.

Scott.