Forum: Ruby on Rails how to collapse all with a toggle

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
997433f165140d58f52b8c0d1d005dc1?d=identicon&s=25 Patrick Aljord (Guest)
on 2007-01-19 16:31
(Received via mailing list)
Hey all,

I have a loop that kind of looks like this:

<% for  item in @items %>
<span id='showbox_<% item_id%>' style="display:none" ><%
<%= link_to_remote 'show other ids', :url=>{:action=>showall} %><br>

What I want to do is when "show other ids" is clicked, the content of
each span is showed (eg. with a toggle) except for  the span that goes
with the link that's been clicked.
any idea how to do this?

Thanx in advance

2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2007-09-25 22:37
(Received via mailing list)
Patrick Aljord wrote:

> any idea how to do this?
In the end, the answer will be a combination of RJS and CSS.  In terms
what exactly that needs to look like, I'm not grokking what you want it
look like initially.  Right now what you have above will show a bunch of
rows where each row is a link that says 'show other ids'.  And that's
More info needed to assist.

Best regards,
997433f165140d58f52b8c0d1d005dc1?d=identicon&s=25 Patrick Aljord (Guest)
on 2007-09-25 22:39
(Received via mailing list)
what is display is:
( 'show other ids'
with being hidden.

let's say I have:
(1) 'show other ids'
(2) 'show other ids'
(3) 'show other ids'

now if I click on the second 'show other ids', then it will change the
rows to:
1 'show other ids'
(2) 'show other ids'
3 'show other ids'

with 1 and 3 visible and 2 still hidden. See what I mean?

thanx in advance

This topic is locked and can not be replied to.