I am using a Palette to assign multiple "Category" objects to a
"Document" object. When I select a Category, the Palette seems to
operate correctly on-screen, but I'm having two issues:
1) debugging the code, the selected choice (in the onUpdate below) is
ALWAYS the first item in the "allCategories" list
2) this (incorrect) Category is added to the Document, but does not
seem to stay that way. If I switch to another Document and then come
back to the original, there are no longer any Categories
I've scoured this list but haven't managed to find something directly
applicable to this situation. Can anyone assist? What am I doing wrong
here?
IChoiceRenderer<Category> renderer = new ChoiceRenderer<Category>
( "name" );
final IModel selected = new Model((Serializable)
selectedDocument.getCategories());
IModel allCategories = new Model((Serializable)categories);
final Palette<Category> documentsPalette = new
Palette<Category>("categoryPalette", selected, allCategories,
renderer, 10, true)
{
@Override
protected Recorder newRecorderComponent()
{
final Recorder recorder = new Recorder("recorder",
this);
recorder.setOutputMarkupId( true );
recorder.add(new AjaxFormComponentUpdatingBehavior
("onchange")
{
@Override
protected void onUpdate( AjaxRequestTarget
ajaxRequestTarget)
{
selectedCategory.addCategory((Category)
recorder.getSelectedChoices().next());
}
});
return recorder;
}
};
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org