#9 ✓resolved
Sean Templeton

Add $js->event()

Reported by Sean Templeton | January 30th, 2010 @ 12:08 AM | in DojoCake 1.3.2

event($type, $content, $options = array())
Bind an event to the current selection. $type can be any of the normal DOM events or a custom event type if your library supports them. $content should contain the function body for the callback. Callbacks will be wrapped with function (event) { ... } unless disabled with the $options.

Options
•wrap - Whether you want the callback wrapped in an anonymous function. (defaults to true)
•stop - Whether you want the event to stopped. (defaults to true)
Example use
$js->get('#some-link'); $js->event('click', $js->alert('hey you!')); If you were using the jQuery library you would get the following Javascript code.

$('#some-link').bind('click', function (event) {

alert('hey you!');
return false;

}); You can remove the return false; by passing setting the stop option to false.

$js->get('#some-link'); $js->event('click', $js->alert('hey you!'), array('stop' => false)); If you were using the jQuery library you would the following Javascript code would be added to the buffer. Note that the default browser event is not cancelled.

$('#some-link').bind('click', function (event) {

alert('hey you!');

});

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Dojo Cake is a library of CakePHP helpers and controllers to make the process of adding Dojo to CakePHP more easy. The library includes helpers for widgets and XHR connections.
Dojo Cake was developed to make the process of making ajax applications in CakePHP as easy as making the application itself, making Web 2.0 applications in CakePHP a piece of cake (pun intended). With a growing number of widgets, and support for basic ajax and xhr connections, Dojo Cake aims to be a powerful link between clientside programming and server-side programming.
The project is hosted on google code at http://dojocake.googlecode.com

Shared Ticket Bins

People watching this ticket

Pages