Hi, Is there a utility in protoype to move one selection in one list to the other list? Satyajit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
No. Prototype will provide the interface for you to do this though.
You''ll need to use Enumerable, $A, appendChild (native),
options[x].selected
(native)
If you appendChild an option to a new select tag, it will move.
Something like this:
$A($(''SelectBox1'').options).findAll(function(option){return
option.selected
}).each(function(selectedOption){$(''SelectBox2'').appendChild(selectedOption)});
I have not tested the above code.
Gareth
On Dec 13, 2007 1:45 PM, Satyajit
<malugu.satyajit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi,
>
> Is there a utility in protoype to move one selection in one list to
> the other list?
>
>
> Satyajit
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
I think $$("#SelectBox1 option:selected") works instead of calling
findAll :)
Other than that, I did one of these when Prototype was around 1.4 (oh,
the "good" times :P), and I remember spending over 2 days making it
work in IE. Of course, $$ and all the magic selectors weren''t there,
so it will probably be easier now.
Good luck :)
-Nicolas
On Dec 13, 2007 11:23 AM, Gareth Evans
<agrath-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> No. Prototype will provide the interface for you to do this though.
>
> You''ll need to use Enumerable, $A, appendChild (native),
options[x].selected
> (native)
>
> If you appendChild an option to a new select tag, it will move.
>
> Something like this:
>
>
$A($(''SelectBox1'').options).findAll(function(option){return
>
option.selected}).each(function(selectedOption){$(''SelectBox2'').appendChild(selectedOption)});
>
> I have not tested the above code.
>
> Gareth
>
>
>
> On Dec 13, 2007 1:45 PM, Satyajit
<malugu.satyajit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > Hi,
> >
> > Is there a utility in protoype to move one selection in one list to
> > the other list?
> >
> >
> > Satyajit
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Oh, the selected psuedo is implemented- nice!
That certainly cleans up the code.
I didnt even think of using the $$ function - in fact, shouldn''t
$(''SelectBox1'').select(''option:selected'') be
even quicker?
Gareth
On 12/14/07, Nicolás Sanguinetti
<godfoca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> I think $$("#SelectBox1 option:selected") works instead of
calling findAll
> :)
>
> Other than that, I did one of these when Prototype was around 1.4 (oh,
> the "good" times :P), and I remember spending over 2 days making
it
> work in IE. Of course, $$ and all the magic selectors weren''t
there,
> so it will probably be easier now.
>
> Good luck :)
> -Nicolas
>
> On Dec 13, 2007 11:23 AM, Gareth Evans
<agrath-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > No. Prototype will provide the interface for you to do this though.
> >
> > You''ll need to use Enumerable, $A, appendChild (native),
> options[x].selected
> > (native)
> >
> > If you appendChild an option to a new select tag, it will move.
> >
> > Something like this:
> >
> >
$A($(''SelectBox1'').options).findAll(function(option){return
> > option.selected
>
}).each(function(selectedOption){$(''SelectBox2'').appendChild(selectedOption)});
> >
> > I have not tested the above code.
> >
> > Gareth
> >
> >
> >
> > On Dec 13, 2007 1:45 PM, Satyajit
<malugu.satyajit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > >
> > > Hi,
> > >
> > > Is there a utility in protoype to move one selection in one list
to
> > > the other list?
> > >
> > >
> > > Satyajit
> > >
> > > > >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---