For drop-down lists (I assume you mean <select> elements), I''d
recommend
breaking things into categories (they probably already are) and using
combo boxes. I have a Ajax.DoubleCombo class that will make this easy
and it can be chained as many times as you like.
http://colin.mollenhour.com/doublecombo/index.html
I''ve added caching ability which is undocumented on that page, but
you''ll need the functions pasted below to use it. Someday I want to
generalize and classify this caching mechanism but so far I''ve only
used
it for selects.
If you want something that takes up a larger portion of the page I have
a nice tree system that can fit your purposes, and I''ve written a
system
for filtering the results and building queries based on the filters. It
is somewhat complex and written in PHP so let me know if you are really
interested in it and I can explain more about it.
Colin
------------
var optionCache = [];
var optionCacheRequests = [];
function fillSelectCached(receiver,key,page,options){
if(options && options.onComplete){
var onComplete = options.onComplete;
delete options.onComplete;
}
if(optionCache[key]){
if(optionCache[key] == ''_option_cache_loading''){
var oldFunction = optionCacheRequests[key].options.onComplete;
optionCacheRequests[key].options.onComplete =
function(xhr,json){
if(oldFunction(xhr,json)){
fillSelectFromObject(receiver,optionCache[key]);
}
}
}else{
fillSelectFromObject(receiver,optionCache[key]);
}
}else{
optionCache[key] = ''_option_cache_loading'';
optionCacheRequests[key] = new Ajax.Request(page,Object.extend({
parameters: ''action=getOptions&id=''+key,
onComplete: function(xhr,json){
if(json && json.error){ alert(json.error); return false;
}
if(!json || !json.options) json =
json_decode(xhr.responseText);
if(!json){ alert(''Error retreiving ''+key);
return false; }
optionCache[key] = json;
fillSelectFromObject(receiver,optionCache[key]);
if(onComplete){ try{ onComplete(); }catch(ex){} }
return true;
}
},options || {}));
}
}
function fillSelectFromObject(receiver,obj){
var box = $(receiver);
box.options.length = 0;
var sel = obj.selected || false;
var opts = obj.options;
for( var i=0; i<opts.length; i++ ){
box.options[i] = new
Option(opts[i].text,opts[i].value,null,(sel&&sel==opts[i].value?true:false));
}
if( obj.selectedIndex ) box.selectedIndex = obj.selectedIndex;
}
Devraj wrote:> Hi everyone,
>
> I am looking for a drop down list or table style solution for people to
> be able to choose product names from to add to a shopping list. The
> list will have about 1500 items so I would like to have some sort of
> filter mechanism.
>
> Any places you guys recommend I look?
>
> Thanks for your time.
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---