I have a panel that should be updated using data from a dialog Modul. In the Panels constructor, I have a datamodel which should populate components in the panel.
The Panel constructor looks like this:
public MyPanel(String id, final MyDataMOdel aDataModel) {
super(id);
....
}
The panel is added in my page as:
MyDataModel myDataModel = new MyDataModel();
MyPanel myPanel = new MyPanel("myPanel", myDataModel);
In the Open Dialog setWindowClosedCallback
method, I have my updated DataModel
myModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback()
{
private static final long serialVersionUID = -1746088901018629567L;
public void onClose(AjaxRequestTarget target)
{
update myDataModel here
Got the updated datamodel here (I can see that it is updated)
target.add(myPanel)
....
This way, I can't see the components in the panel got updated.
For the time being, I solved as follows:
remove(myPanel);
myPanel = new MyPanel("myPanel", myUpdatedDataModel);
myPanel.setOutputMarkupId(true);
add(myPanel);
target.appendJavaScript("window.location.reload()");
Am not sure what your MyDataModel()
is. But you can use shared wicket Models.
Model<YourDataObjectToShare> dataObjectToSHare = new Model<YourDataObjectToShare>()
{
private static final long serialVersionUID = -6394439155356911110L;
@Override
public YourDataObjectToShare getObject()
{
return ... The Updated Shared data here
}
};
Then Pass dataObjectToSHare
to the panels argument
Look this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.