I got a /Unexpected RuntimeException Last cause: Attempt to set model object
on null model of component: form:companiesList/ whenever I select an item in
my DropDownChoice.
I read somewhere that it was because there is no Model set, but there *is*
one (a LoadableDetachableModel) :
ChoiceRenderer<CompanyConfiguration> choiceRenderer = new
ChoiceRenderer<CompanyConfiguration>("name", "id");
DropDownChoice<CompanyConfiguration> ddc = new
DropDownChoice<CompanyConfiguration>("companiesList",
new
LoadableDetachableModel<List<CompanyConfiguration>>() {
private static final long serialVersionUID =
8752933117323402630L;
@Override
protected List<CompanyConfiguration> load() {
final List<CompanyConfiguration>
configs = getCompaniesList();
Collections.sort((List<CompanyConfiguration>) configs, new
Comparator<CompanyConfiguration>() {
@Override
public int
compare(CompanyConfiguration o1, CompanyConfiguration o2) {
return
o1.getName().compareTo(o2.getName());
}
});
return configs;
}
}, choiceRenderer) {
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
protected void onSelectionChanged(final CompanyConfiguration
newSelection)
{
logger.debug("Selected base: " + newSelection.getId());
}
};
Has anyone an idea about what I'm doing wrong?
Note: I cannot serialize my CompanyConfiguration list.
BTW, second question: there is a DataView with a ListDataProvider elsewhere
in the page. How can I update its values from the method
onSelectionChanged() above?
Thanks a lot!
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/LoadableDetachableModel-and-Attempt-to-set-model-object-on-null-model-of-component-tp4659453.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]