Recent Script.aculo.us tutorial

I would like to add a visual effect to one of my web pages and in the stage where I don’t know what I don’t know. I’ve talked to my buddy Google about this and (s)he has pointed me at a number of different web pages that all seem to have 2006 dates on them. I can try looking at them more carefully (and will keep looking), but I thought I would toss my question out to you folks in the mean time.

I would like to display (in my #index view) a table of some data. Most (if not all) of the rows have other data associated with them. I would like to display a plus sign next to each row which, when clicked by the user, would expand the view to include the associated data – sort of like the way Gmail can expand and collapse “conversations”.

Can anybody point me at a recent tutorial that might get me started down this path?

Thanks…

–wpd

Sounds like you just need to learn Javascript. Doesn't seem like a Rails problem/question at all.

That’s a fair reply. I have read (without understanding) a number of different posts about how great “RJS” is because it hides all of that messy Javascript from the Rails developer. I imagine one can only appreciate how great RJS is once one has a certain amount of Javascript experience and has learned how messy it can be.

I’ll head down that path. Thanks.

–wpd

There are different paths you can take. Prototype/Scriptaculous is (currently) incorporated into the framework, so that can be an easy place to start (particularly when using rjs to deal with controller- type actions in your controllers).

Another route is to learn and use jQuery or another javascript frameworks). These may behave differently, and have benefits or weaknesses when compared with Prototype.

The API documentation for the frameworks themselves are really helpful places to start. For using them with Rails, railscasts.com is a fantastic place to get pointers (search for 'rjs', 'prototype' or 'jQuery').

Hi,

you will simply need to create a div with the data in a hidden row below and add the javascript to the onclick option. This is actually so simple that it not worth encapsulating this in rails, imho.

Check this link:

http://wiki.github.com/madrobby/scriptaculous/effect-appear

If you have the time get a copy of the book Ajax on Rails (O'Reilly). It's excellent.