从页面切换到页面时,我想在表单页面中缓存状态。
所以:我有 3 页表格,当我从一个切换到另一个时,我希望数据保留在表格中。
我发现了这个:https ://wiki.eclipse.org/Scout/Concepts/Page_Detail_Form
@Override
protected void execPageActivated() throws ProcessingException {
if (getDetailForm() == null) {
PersonDetailForm form = new PersonDetailForm();
form.setPersonNr(getPersonNr());
setDetailForm(form);
form.startView();
}
}
并说 setDetailForm() 缓存数据
As already said, attaching a detail form to a page means the detail form will automatically be
hidden when the page gets deactivated and shown when the page gets activated (see
PageDetailFormChanged on Desktop). So the detail form actually gets cached and does not need to
be started more than once per page. This requires that the form does not get closed.
但这对我不起作用。
我的代码是
@Override
protected void execPageActivated() throws ProcessingException {
// / Create and open form
if (getDetailForm() == null) {
MarginCalculationForm form = new MarginCalculationForm();
form.startModify();
setDetailForm(form);
}
super.execPageActivated();
}
但它停留在最后一页。
例如 :
如果我有页面 A、B、C 并且我打开页面 A,它会自行创建它并将其设置为 detailForm()。如果我然后打开页面 B 也可以。但是,如果我然后再次单击页面 A,它会检查 detailForm() 是否不为空(并且它不是),因此它会停留在页面 B 上(插入页面 A)
编辑 :
我认为 getDetailForm() 正在返回正确的表单,但显然 super.execPageActivated() 不起作用。