Basic Event handling through JavasciptMvc

12 views
Skip to first unread message

Andrew Mori

unread,
Oct 4, 2010, 8:39:30 AM10/4/10
to JavaScriptMVC
Hi.

I am desperately trying to handle events the JavascriptMVC way, and I
am trying to avoid event plugins and JQuery.

I initially created my app and controllers without considering event
handling. Now I am at the point where I need to handle basic click and
mouseover events and so far I have struggled to implement what has
been suggested at http://wiki.javascriptmvc.com/wiki/index.php?title=Event_Overview

I am currently working in my basic html file called reports.html and
within the appropriate controller report_controller.js

is it possible to extend my current controller to handle events or do
I specifically have to create a controller to handle events separate
to my report_controller?

I would really appreciate a code example on how to handle say, a
simple click event with a simple alert message. I really want to do
this specifically tailored through JavascriptMvc and not some external
plugin.


Regards

Andrew

Alexandre Gomes

unread,
Oct 4, 2010, 9:59:09 AM10/4/10
to javasc...@googlegroups.com
You can see some examples of how to handle events using controllers here:


Hope that helps.


--
You received this message because you are subscribed to the Google Groups "JavaScriptMVC" group.
To post to this group, send email to javasc...@googlegroups.com.
To unsubscribe from this group, send email to javascriptmv...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascriptmvc?hl=en.


Thomas Reynolds

unread,
Oct 4, 2010, 10:57:15 AM10/4/10
to javasc...@googlegroups.com, javasc...@googlegroups.com
Is this controller onDocument? There is a strange feature where onDocument controllers have all their selectors prefixed with an id of the same name as the controller.

So "a click" becomes "#reports a click" which won't match anything if you don't have some wrapper div with that id.

-Thomas

Andrew Mori

unread,
Oct 4, 2010, 10:59:04 AM10/4/10
to JavaScriptMVC
yes, that has pushed me in the right direction, thank you very much.

Andrew
Reply all
Reply to author
Forward
0 new messages