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? -- Posted via http://www.ruby-forum.com/.
Google for acts_as_tree and livetree. I think the pair is what you''re looking for. -- -- Tom Mornini On Jun 8, 2006, at 1:15 PM, Mantat wrote:> 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? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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!!! -- Posted via http://www.ruby-forum.com/.
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... -- Posted via http://www.ruby-forum.com/.
On Jun 8, 2006, at 8:01 PM, Mantat wrote:> 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.Oh, THAT OS X Finder view! There are 3 of them, after all. :-) Sorry for the misinformation. -- -- Tom Mornini
jeanpierre@gmail.com
2006-Jun-09 07:11 UTC
[Rails] Re: How to make an OSX Finder in rails/AJAX?
these people seem to do a convincing rendition of the finder''s column view =) http://www.apple.com/downloads/dashboard/ On 6/8/06, Tom Mornini <tmornini@infomania.com> wrote:> > On Jun 8, 2006, at 8:01 PM, Mantat wrote: > > > 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. > > Oh, THAT OS X Finder view! > > There are 3 of them, after all. :-) > > Sorry for the misinformation. > > -- > -- Tom Mornini > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060609/f3bff921/attachment-0001.html
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... -- Posted via http://www.ruby-forum.com/.
Jon Gretar Borgthorsson
2006-Jun-09 11:32 UTC
[Rails] Re: Re: How to make an OSX Finder in rails/AJAX?
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 <mantat@videotron.ca> wrote:> 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... > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- -------------- Jon Gretar Borgthorsson http://www.jongretar.net/