if you push the submit button before sending any event, you will see that 
changes made to the model are saved correclty.

But in case you fire any event, you redisplay 'this' (the palette) before the 
model is updated.
The state of this, in that case, is like a new original palette.
So far, only the javascript on the client side has been executed.



François Meillet
Formation Wicket - Développement Wicket






Le 19 févr. 2013 à 18:52, grazia <grazia.russolass...@gmail.com> a écrit :

> I sort of got it to work, but now when I move items from one side of the
> palette to the other and try to save it, the changes are not picked up by
> the model and are not saved ...
> 
> public class MyPalette extends Palette {
> private List<T> unselectedChoices;
> public MyPalette(String id, IModel<List&lt;T>> model,
>                       IModel<List&lt;T>> choicesModel, IChoiceRenderer<T> 
> choiceRenderer,
>                       int rows, boolean allowOrder) {
>               super(id, model, choicesModel, choiceRenderer, rows, 
> allowOrder);
>               
>               setOutputMarkupId(true);
>               unselectedChoices = new ArrayList<T>();
>       
> 
>       }
> 
> @Override
>       public void onEvent(IEvent<?> event) {
> 
>               super.onEvent(event);
> 
>               if (event.getPayload() instanceof MyAutoCompleteUpdate) {
> 
>                       MyAutoCompleteUpdate update = (MyAutoCompleteUpdate) 
> event
>                                       .getPayload();
> 
>                       Collection collection = this.getChoices(); // the whole 
> set of data,
> availalble (unselected) and associated (selected)
>                        System.out.println("SIZE " + collection.size() + " ");
>                                               
>                       
>                       unselectedChoices.add((T) update.getModelObject());
>                       System.out.println("SIZE UNSELECTED" + 
> unselectedChoices.size() + " ");
>                       
>                       collection.addAll(unselectedChoices);
>                       System.out.println("SIZE AFTER ADDING selection" + 
> collection.size() + "
> ");
>                       
>               
> 
>                       update.getTarget().add(this);
> 
>               }
> 
>       }
> 
> }
> 
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/unselected-choices-of-Palette-contain-duplicates-tp4656430p4656566.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

Reply via email to