How to make an OSX Finder in rails/AJAX?

I need to make a category browser that would allow nested categories. Is
there any receipe on that?

Currently, I use the :onchange event from one of the form element to
update the first select (out of 4-5 selects), but I dont know how to
elegantly reset all the child selects if I change the value from the
first.

All the categories are fetched from the DB and I would like a ‘generic’
solution to this. My current solution involves too much coupling between
the Controller and the view and thats a Bad Thing ™.

Anyone can help with this?

Google for acts_as_tree and livetree.

I think the pair is what you’re looking for.


– Tom M.

Tom, you saved me days of troubles!!! Thanks a lot!

I was already using the act_as_tree but my googling never poped the
livetree site.

You have no idea how happy I am! even tho I learned a lot trying to
emulate that thing, I am happy to find something already tested and
complete!

Ye!!!

On Jun 8, 2006, at 8:01 PM, Mantat wrote:

click on a value in the first column, it fetch the data from the DB
then
populate the second column. Then, when you pick a value from the
second
column, it will update the third.

Oh, THAT OS X Finder view!

There are 3 of them, after all. :slight_smile:

Sorry for the misinformation.


– Tom M.

these people seem to do a convincing rendition of the finder’s column
view
=)
Apple - Support - Downloads

Crap… .I feel stupid to reply to myself after my previous post but…

I talked too fast! I look at the specs, everything was fine until I
looked at the screenshots.

The finder offered by livetree is more like the file explorer of
windows. The Finder on the mac that I was talking about is the one that
display each ‘level’ in a column. So let say we have 3 columns, when you
click on a value in the first column, it fetch the data from the DB then
populate the second column. Then, when you pick a value from the second
column, it will update the third.

The problem is if at that time I click on the first column, it needs to
clear the thrid column and update the second…

I have a solution in my head to do this but it involves a lot of
javascript and too much coupling between the controller and the view…

So still looking…

unknown wrote:

these people seem to do a convincing rendition of the finder’s column
view
=)
Apple - Support - Downloads

Actually, they dont… the column no 3 doesnt clear when you change the
selected item form colum 1…

This is really not as easy as I fight thought!!! I will keep you
informed of my progress…

Ajax and partials should help you there.

apple.com does this with this structure

Thus. It only updates col_2 when something is selected in col_1. However. You could organize this like so:

That way. When you do an ajax call to change col_2 it automatically
removes col_3. You just have to include

at the
end of your col_2 partial.

On 6/9/06, Mantat [email protected] wrote:

informed of my progress…


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails