On Monday, July 2, 2012 10:25:29 PM UTC+2, peter.bittner wrote:
>
> 2012/7/2 Daniel Gonzalez <gonva...@gmail.com>: 
> > I am preparing a form with some data collected from the server. Most 
> fields 
> > have some pre-set values, but they can be changed using a drop-down. 
> > Moreover, the user must also have the option to enter free text for 
> those 
> > fields. For this I need an editable drop-down. Could you give me any 
> hints 
> > on how to implement this in pyjamas? 
>
> Editable drop-down. With Pyjs this is probably tricky, you'd have to 
> implement this from scratch, I would guess. The ListBox widget doesn't 
> support being editable, http://pyjs.org/examples/Showcase.html 
>
> Are you looking for something like this here? 
> http://ivaynberg.github.com/select2/ 
>
> Peter 
>

Exactly Peter. How easy would be to integrate this with pyjs? My experience 
with jQuery is very limited.

What my editable drop-downs must do is:

   - it must be initialized with an active value.
   - it must have several available options. Typing should suggest one of 
   those options.
   - if the user has typed something new, it must be accepted as is.
   - it should be possible to select one option via the dropdown, replacing 
   the active text.
   - once the form (containing all my drop-downs) is submitted, it must 
   read the active value in the drop-down and send it via JSONRPC

I am currently doing this with a TextBox, and it is not very nice. Having 
the Select2 component would be great, but I am worried about the complexity 
of having some extra jQuery code within my pyjs base. From the link you 
sent, I understand that the Select2 component satisfies my requirements 
(and then some). It is reading / writing to it from pyjs that is unclear 
for me.

Thanks,
Daniel

Reply via email to