我正在使用focframework
我以编程方式包含了一个表单,但是当我单击父表单上的应用以触发保存到数据库时,子级更改不会保存,仅保存父级更改。
这就是我以编程方式添加表单的方式,我确实添加了行 setParentLayout()
:
//Get the vertical layout where we want to add the new sub form
FVVerticalLayout verticalLayout = getComponentByName("_VERTICAL_LAYOUT");
//Create the view Key
XMLViewKey key = new XMLViewKey(MyEntityDesc.getInstance().getStorageName(), XMLViewKey.TYPE_FORM);
//Using the Key build my Form and send my user data myFocObject
FocXMLLayout myForm = XMLViewDictionary.getInstance().newCentralPanel(getMainWindow(), key, myFocObject);
//Add my Form to the verticalLayout
verticalLayout.addComponent(myForm);
//Tell the form that the "this" form class is the parent layout
myForm.setParentLayout(this);
最佳答案
要使应用于父布局的“保存”传播到子布局并保存它,您需要通过设置标志 commitWithParent 来指定:
myForm.setCommitWithParent();
如果包含是使用 XML 标记完成的,您可以使用相关属性设置该标志,如下所示:
<HorizontalLayout captionMargin="0" spacing="true" margin="true" visibleWhen="Anonymous=false">
<IncludeXML dataPath="Empl" storage="Employee" type="Form" commitWithParent="true" />
</HorizontalLayout>
注意:当使用 XML 标记完成包含时,默认标志值为“true”。而使用代码添加布局时默认值为 false。
关于java - 在 Foc 中,当以编程方式包含子表单时,不会将其内容与父表单一起保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50970914/