We have an ajax event initiated by one panel that affects the data, and needs
to force a redraw of a radiogroup in another panel. The ajax event arrives,
we add the radiogroup to the target, update the model that backs the
ListView, but the populateItem method never re-fires to redraw. Note that
this is in Wicket 1.4.7.
The following is the creation of the radio group.
group = new RadioGroup("roles", new Model<KeyValueBean>(getDefaultBean()));
group.setOutputMarkupId(true);
group.setRenderBodyOnly(false);
add(group);
appBean.setUmcOnlyRoles(umcOnlyRoles);
LoadableDetachableModel modelRoles = new LoadableDetachableModel() {
protected Object load() {
return appBean.getUmcOnlyRoles();
};
// add all roles
ListView<KeyValueBean> rolesList = new ListView<KeyValueBean>("radioList",
modelRoles){
protected void populateItem(final ListItem<KeyValueBean> item) {
final KeyValueBean bean = item.getModelObject();
@SuppressWarnings("rawtypes")
Radio radio = new Radio("radio", item.getModel()) {
//snipped for brevity
};
rolesList.setOutputMarkupId(true);
rolesList.setReuseItems(true);
group.add(rolesList);
In the ajax event we do this:
Panel app = (Panel)get("apps");
UMCApplicationPanel umc = (UMCApplicationPanel)app.get("umcPanel");
RadioGroup rolesMarkup = (RadioGroup)umc.get("roles");
//snipper for brevity
bean.setUmcOnlyRoles(umcOnlyRoles);
bean.seteShareChecked(eShareChecked);
target.addComponent(rolesMarkup);
The "bean" in this event is the same object as the "appBean" in the load
method of the detachable model in the constructor above. I can confirm that
the detachable model load fires and the right data is in it. Yet the
populateItem never runs...so the list is unchanged.
to force a redraw of a radiogroup in another panel. The ajax event arrives,
we add the radiogroup to the target, update the model that backs the
ListView, but the populateItem method never re-fires to redraw. Note that
this is in Wicket 1.4.7.
The following is the creation of the radio group.
group = new RadioGroup("roles", new Model<KeyValueBean>(getDefaultBean()));
group.setOutputMarkupId(true);
group.setRenderBodyOnly(false);
add(group);
appBean.setUmcOnlyRoles(umcOnlyRoles);
LoadableDetachableModel modelRoles = new LoadableDetachableModel() {
protected Object load() {
return appBean.getUmcOnlyRoles();
};
// add all roles
ListView<KeyValueBean> rolesList = new ListView<KeyValueBean>("radioList",
modelRoles){
protected void populateItem(final ListItem<KeyValueBean> item) {
final KeyValueBean bean = item.getModelObject();
@SuppressWarnings("rawtypes")
Radio radio = new Radio("radio", item.getModel()) {
//snipped for brevity
};
rolesList.setOutputMarkupId(true);
rolesList.setReuseItems(true);
group.add(rolesList);
In the ajax event we do this:
Panel app = (Panel)get("apps");
UMCApplicationPanel umc = (UMCApplicationPanel)app.get("umcPanel");
RadioGroup rolesMarkup = (RadioGroup)umc.get("roles");
//snipper for brevity
bean.setUmcOnlyRoles(umcOnlyRoles);
bean.seteShareChecked(eShareChecked);
target.addComponent(rolesMarkup);
The "bean" in this event is the same object as the "appBean" in the load
method of the detachable model in the constructor above. I can confirm that
the detachable model load fires and the right data is in it. Yet the
populateItem never runs...so the list is unchanged.