Thank you all - just the examples I needed to move on!
redheat: nice and lean - thanks :-)
Best regards
Martin
On Nov 10, 10:26 am, redheat <[EMAIL PROTECTED]> wrote:
> If you need to run the same function each time, but sending the
> relevant tr element,
>
> $$('tr.details').invoke('observe', 'click', function(e)
> {
> myFunction(this); // this refers to the tr you clicked on
>
> });
>
> On Nov 9, 4:15 pm, Wizz <[EMAIL PROTECTED]> wrote:
>
> > You were nearly there... If you're using the newest release of
> > prototype (v1.6.0), you could use a syntax like this:
>
> > $$('tr.details').each(function(row) {
> > row.observe('click', myFunction.curry(''));
>
> > });
>
> > not sure about the .curry() part, but it should work...
>
> > Greetz
>
> > On Nov 8, 11:13 pm, Martin <[EMAIL PROTECTED]> wrote:
>
> > > Hi all
>
> > > I'm new to Prototype, and am stuck at trying to bind an on clickevent-
> > > listener to some table rows.
>
> > > I have normal table (don't worry, it IS tabular data).
> > > I would like a certain function to fire when rows with a specific
> > > className is clicked, so I do this:
> > > var theRows = $$('tr.details');
>
> > > Now, I then try to use the 'each' function,like this:
> > > trs.each(Event.observe(Element,'onclick',myFunction('')));
> > > Obviously wrong ...
>
> > > I've digged through the api-docs, but can't find the correct way to do
> > > this.
>
> > > Any ideas?
>
> > > Best regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---