EJS and event handling

1,251 views
Skip to first unread message

Sel

unread,
Nov 5, 2009, 6:18:04 AM11/5/09
to Embedded JavaScript
Hi,
I know that JMVC covers it but i don't want to use JMVC in current
project (i have different design pattern than suggesten in jmvc).

What i have to do is to trigger an event on a component that stores
the view(ejs).

I want to:

<div id="middleCol_menu">
<a href="#" onclick=" <% trigger('tabChange') %>"
class="tab_first">Click!</a>
</div>

and initialization:
var Component = new JS.Class({
render: function() {
return this._template.render(this);
},

trigger: function(eventName) {
alert('event: ' + eventName + ' triggered');
}
})

How can I do this think?
Is it possible to call the template function after it's rendered?

Justin Meyer

unread,
Nov 5, 2009, 10:19:49 AM11/5/09
to embeddedj...@googlegroups.com
After you inject it in the dom, find the element and attach the event
handler.

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages