I have a collection of products that I am showing in a dropdown. Now
at the first view it will show only first 10 products in the dropdown
with an option “more…” at last. if user clicks the “more…” he can
see all the following products in that dropdown list (this is not any
ajax request, just javascript show/hide). Of course the more… option
will hide when showing all items.
Any suggestion for it? My select tag have a “onchange” which submits
the form and hence showing that product description.
I cant find out the exact way to do this. Please help
On 10 April 2010 09:47, Samiron [email protected] wrote:
I have a collection of products that I am showing in a dropdown. Now
at the first view it will show only first 10 products in the dropdown
with an option “more…” at last. if user clicks the “more…” he can
see all the following products in that dropdown list (this is not any
ajax request, just javascript show/hide). Of course the more… option
will hide when showing all items.
I don’t know your reasoning for doing this, but assuming it’s to make
the UI
a bit cleaner (rather than the fact that the list is HUGE, in which case
searching would be a better UI option anyway) I’d personally do this
with
jQuery rather than Rails/Ajax. If you’re using Prototype you’ll need
someone who knows that framework to translate this jQuery code.
I’ve tested the code below in Safari and it works fine, you may need to
tweak it for your needs though…
Cheers,
Andy
Test option enabling
Option 1
Option 2
Option 3
Option 4
Option 5
Option 6
Option 7
Option 8
Option 9
Option 10
Option 11
Option 12
Option 13
Option 14
Option 15
Option 16
Option 17
Option 18
Option 19
Option 20
You could always just render the output the results to the screen and
not mess with the drop down. That would be much easier, then you
could just have a “more” button at the bottom like twitter does.