1) I am using a ListView to populate some 2 labels from database. The table has 100 rows so I get 100 <TD>s. This works fine.
this.selectView = new PageableListView("selectedBG", new PropertyModel(this, "selectedList"), 10) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem item){
selParentGclOrg = new Label("selParGclOrgId", new PropertyModel(gclOrg, "parentGclOrgId"));
selParentGclOrg.setOutputMarkupId(true);
final AjaxLink ajl = new AjaxLink("clickMe"){
public void onClick(AjaxRequestTarget target){
chilgGcl = gclOrg.getGclOrgId();
selectPopUp.show(target);
}
};
ajl.add(selParentGclOrg);
final Label lblGclOrg = new Label("selGclOrgId", Integer.valueOf(gclOrg.getGclOrgId()).toString());
item.add(ajl);
item.add(lblGclOrg);
}
}
2) One label is hyperlinked and opens a popup window from which I can select possible values for label 2. The popup window opens perfectly.
selectPopUp = new select_popUP("showModal",container){
@Override
public void onSelect(AjaxRequestTarget target, int gclOrgId){
selParentGclOrg.setModelObject(Integer.toString(gclOrgId));
target.addComponent(selectView);
close(target);
}
@Override
public void onCancel(AjaxRequestTarget target){
close(target);
}
};
3) In the popup window, possible values are hyperlinked. Clicking on it closes the popup window and sends the possible value to the main page. This works ok… I think.
4) The new value is assigned to Label 2 using:
target.addComponent(selectView);
This is where I am getting stuck. Wicket is supposed to change the label on the same row (at least, I think) but it’s updating the Label 2 of the last row.
What am I doing wrong?
I think the relevant parts of your code are missing from the post…
Like:
gclOrgis setselParentGclOrgis set for the ModalWindowJudging from what I can see, I would put my bet on an issue with populateItem beeing run way after the rest of the code in your class… Most of your code will be run on constructor time or onBeforeRender, populateItem will be called sometimes during rendering… But that’s just a wild guess.