Re: How to update a palette?

2011-10-01 Thread Wolfgang Schreiner
Finally solved it:

had a choice renderer

new ChoiceRenderer() {
  public Object getDisplayValue(DocumentDto object) {
return object.getDocumentType();
  }
}

which apparently messed things up

changed it to new ChoiceRenderer("documentType", "documentId") and 
everything works fine

overriding getIdValue also works!

Have a nice weekend




From:
Wolfgang Schreiner/AUT/CSC@CSC
To:
users@wicket.apache.org
Date:
30.09.2011 13:26
Subject:
Re: How to update a palette?



What do you mean by "refresh"? I apply "setOutputMarkupId" on the palette 
and add it to the Ajax request target.

This is how I thought it should work, apparently I missed something ...

final ListModel types = loadChoicesFromDB();
final ListModel selectedTypes = new ListModel(new ArrayList());
final Palette palette = new Palette("palette", selectedTypes, types ... );
palette.setOutputMarkupId(true);
...
final DropDownChoice profiles = ...
profiles.add(new AjaxComponentUpdatingBehavior("onchange") {
  public void onUpdate(AjaxRequestTarget target) {
Integer profileId = profiles.getModelObject().getProfileId();
// selectedTypes.detach();
selectedTypes.setObject(loadSelectedTypesFromDB(profileId));
...
target.add(palette);
  }
});





From:
Duy Do 
To:
users@wicket.apache.org
Date:
30.09.2011 12:58
Subject:
Re: How to update a palette?



Did you refresh the pallete after chaning its model?

Duy

On Fri, Sep 30, 2011 at 3:03 PM, Wolfgang Schreiner 
wrote:

> Dear all,
>
> I need to create a palette which has to be updated on selection changes 
in
> a drop down choice. The drop down choice contains a list of profiles. 
Each
> profile has the same choices but different selected items stored in a
> database. When a user changes the profile selection (Ajax), the palette
> has to show different "available" and "selected" choices.
>
> I am searching for a solution for a while now, and there seem to be a
> number of people having similar issues but I couldn't find a working
> example. The problem is that the "selected" panel does not update
> correctly (remains empty), although during debugging the "model" and the
> "choices" imho contain the correct vales. Removing and adding the 
palette
> from the form doesn't work either. I need to use a palette because the
> order of the items is important!
>
> Any help is highly appreciated. It's getting pretty frustrating.
>
> Cheers,
>
> w
>



-- 
Duy Do






Re: How to update a palette?

2011-09-30 Thread Wolfgang Schreiner
What do you mean by "refresh"? I apply "setOutputMarkupId" on the palette 
and add it to the Ajax request target.

This is how I thought it should work, apparently I missed something ...

final ListModel types = loadChoicesFromDB();
final ListModel selectedTypes = new ListModel(new ArrayList());
final Palette palette = new Palette("palette", selectedTypes, types ... );
palette.setOutputMarkupId(true);
...
final DropDownChoice profiles = ...
profiles.add(new AjaxComponentUpdatingBehavior("onchange") {
  public void onUpdate(AjaxRequestTarget target) {
Integer profileId = profiles.getModelObject().getProfileId();
// selectedTypes.detach();
selectedTypes.setObject(loadSelectedTypesFromDB(profileId));
...
target.add(palette);
  }
});





From:
Duy Do 
To:
users@wicket.apache.org
Date:
30.09.2011 12:58
Subject:
Re: How to update a palette?



Did you refresh the pallete after chaning its model?

Duy

On Fri, Sep 30, 2011 at 3:03 PM, Wolfgang Schreiner 
wrote:

> Dear all,
>
> I need to create a palette which has to be updated on selection changes 
in
> a drop down choice. The drop down choice contains a list of profiles. 
Each
> profile has the same choices but different selected items stored in a
> database. When a user changes the profile selection (Ajax), the palette
> has to show different "available" and "selected" choices.
>
> I am searching for a solution for a while now, and there seem to be a
> number of people having similar issues but I couldn't find a working
> example. The problem is that the "selected" panel does not update
> correctly (remains empty), although during debugging the "model" and the
> "choices" imho contain the correct vales. Removing and adding the 
palette
> from the form doesn't work either. I need to use a palette because the
> order of the items is important!
>
> Any help is highly appreciated. It's getting pretty frustrating.
>
> Cheers,
>
> w
>



-- 
Duy Do




Re: How to update a palette?

2011-09-30 Thread Duy Do
Did you refresh the pallete after chaning its model?

Duy

On Fri, Sep 30, 2011 at 3:03 PM, Wolfgang Schreiner wrote:

> Dear all,
>
> I need to create a palette which has to be updated on selection changes in
> a drop down choice. The drop down choice contains a list of profiles. Each
> profile has the same choices but different selected items stored in a
> database. When a user changes the profile selection (Ajax), the palette
> has to show different "available" and "selected" choices.
>
> I am searching for a solution for a while now, and there seem to be a
> number of people having similar issues but I couldn't find a working
> example. The problem is that the "selected" panel does not update
> correctly (remains empty), although during debugging the "model" and the
> "choices" imho contain the correct vales. Removing and adding the palette
> from the form doesn't work either. I need to use a palette because the
> order of the items is important!
>
> Any help is highly appreciated. It's getting pretty frustrating.
>
> Cheers,
>
> w
>



-- 
Duy Do


How to update a palette?

2011-09-30 Thread Wolfgang Schreiner
Dear all,

I need to create a palette which has to be updated on selection changes in 
a drop down choice. The drop down choice contains a list of profiles. Each 
profile has the same choices but different selected items stored in a 
database. When a user changes the profile selection (Ajax), the palette 
has to show different "available" and "selected" choices.

I am searching for a solution for a while now, and there seem to be a 
number of people having similar issues but I couldn't find a working 
example. The problem is that the "selected" panel does not update 
correctly (remains empty), although during debugging the "model" and the 
"choices" imho contain the correct vales. Removing and adding the palette 
from the form doesn't work either. I need to use a palette because the 
order of the items is important!

Any help is highly appreciated. It's getting pretty frustrating.

Cheers,

w