expand all nested records in list

4 views
Skip to first unread message

Tracy

unread,
Dec 31, 2009, 12:34:32 PM12/31/09
to ActiveScaffold : Ruby on Rails plugin
Is there a way to expand (or close) all inline nested records in a
displayed list?

thanks

Tracy

unread,
Dec 31, 2009, 2:39:22 PM12/31/09
to ActiveScaffold : Ruby on Rails plugin
This bit of js opens them all, but i'm not quite sure how to tie it
into a table action link:

$$('a.action').each(function(item)
{
if(item.className == 'show action')
{
item.action_link.open();
}
});

Sergio Cambra .:: entreCables S.L. ::.

unread,
Jan 4, 2010, 3:57:03 AM1/4/10
to actives...@googlegroups.com
On Jueves, 31 de Diciembre de 2009 20:39:22 Tracy escribió:
> This bit of js opens them all, but i'm not quite sure how to tie it
> into a table action link:
>
> $$('a.action').each(function(item)
> {
> if(item.className == 'show action')
> {
> item.action_link.open();
> }
> });

You can create a JS function with that code, and attach it to onclick event:
Event.observe('action_link_id', 'click', your function);

Or you can set that code as action response, and set :position false to that
action link:
config.action_links.add 'action_name', :label => 'Text', :type => :table,
:position => false

And create a view named action_name.js.rjs:
page << %|
$$('a.action.show').each(function(item) {
item.action_link.open();
});
|

>
> On Dec 31, 9:34 am, Tracy <tracy.har...@gmail.com> wrote:
> > Is there a way to expand (or close) all inline nested records in a
> > displayed list?
> >
> > thanks
>

> --
>
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send
> email to actives...@googlegroups.com. To unsubscribe from this group,
> send email to activescaffol...@googlegroups.com. For more
> options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.

--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) ser...@entrecables.com

Tracy

unread,
Jan 6, 2010, 3:56:01 PM1/6/10
to ActiveScaffold : Ruby on Rails plugin
Thanks Sergio.. That's basically what I ended up with.

For completeness, close_all.rjs works fine, too:
page << "$$('a.action.show').each(function(item)
{ item.action_link.close(); });"

On Jan 4, 12:57 am, "Sergio Cambra .:: entreCables S.L. ::."

Reply all
Reply to author
Forward
0 new messages