The model is updated after a submit or an ajax event.
You need to choose and to implement it.


François Meillet
Formation Wicket - Développement Wicket





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

> So, what do I do to update the palette's model with the changes before
> target.add(this) ?
> 
> On Tue, Feb 19, 2013 at 3:23 PM, Francois Meillet [via Apache Wicket] <
> ml-node+s1842946n4656572...@n4.nabble.com> wrote:
> 
>> 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 <[hidden 
>> email]<http://user/SendEmail.jtp?type=node&node=4656572&i=0>>
>> 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: [hidden 
>>> email]<http://user/SendEmail.jtp?type=node&node=4656572&i=1>
>>> For additional commands, e-mail: [hidden 
>>> email]<http://user/SendEmail.jtp?type=node&node=4656572&i=2>
>>> 
>> 
>> François Meillet
>> Formation Wicket - Développement Wicket
>> 
>> 
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> 
>> http://apache-wicket.1842946.n4.nabble.com/unselected-choices-of-Palette-contain-duplicates-tp4656430p4656572.html
>> To unsubscribe from unselected choices of Palette contain duplicates ..., 
>> click
>> here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4656430&code=R3JhemlhLlJ1c3NvTGFzc25lckBnbWFpbC5jb218NDY1NjQzMHwyMjY4MDg1NDM=>
>> .
>> NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/unselected-choices-of-Palette-contain-duplicates-tp4656430p4656577.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