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 (tm). Anyone can help with this?
on 2006-06-09 00:15
on 2006-06-09 01:34
Google for acts_as_tree and livetree. I think the pair is what you're looking for. -- -- Tom M.
on 2006-06-09 06:53
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 2006-06-09 07:01
on 2006-06-09 08:42
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. :-) Sorry for the misinformation. -- -- Tom M.
on 2006-06-09 11:11
these people seem to do a convincing rendition of the finder's column view =) http://www.apple.com/downloads/dashboard/
on 2006-06-09 15:24
unknown wrote: > these people seem to do a convincing rendition of the finder's column > view > =) > http://www.apple.com/downloads/dashboard/ 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...
on 2006-06-09 15:34
Ajax and partials should help you there. apple.com does this with this structure <div id="col_1"></div><div id="col_2"></div><div id="col_3"></div> Thus. It only updates col_2 when something is selected in col_1. However. You could organize this like so: <div id="col_1"><div id="col_2"><div id="col_3"></div></div></div> That way. When you do an ajax call to change col_2 it automatically removes col_3. You just have to include <div id="col_3"></div> at the end of your col_2 partial. On 6/9/06, Mantat <firstname.lastname@example.org> wrote: > informed of my progress... > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > email@example.com > http://lists.rubyonrails.org/mailman/listinfo/rails > --