SAP UI5:将formContainers动态添加到表单

时间:2018-06-26 10:18:09

标签: sapui5

如果选中了“添加终端”复选框,则要求添加一个现有的表单容器(在表单中)。注意,将同一组输入添加到另一个容器中。因此,它基本上是一个已经在form中添加的容器的副本。尝试使用addFormContainer()和insertFormContainer(),但是这些似乎都不起作用。

			<form:Form id="terminalForm" width="100%" editable="true" visible="true">
				<form:title>
					<core:Title text="Terminals and Materials" level="H3"/>
				</form:title>
				<form:formContainers>
					<form:FormContainer id="terminalContainer" visible="true">
						<form:formElements>
							<form:FormElement visible="true">
								<form:label>
									<Label text="HiddenLabel" visible="false" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<RadioButtonGroup
										id="sap_Responsive_Page_0-c813e6e4e80e22220f88a12c2_S2-content-build_simple_form_Form-1522924154302-formContainers-build_simple_form_FormContainer-1-formElements-build_simple_form_FormElement-1-fields-sap_m_RadioButtonGroup-1522924315063"
										columns="8" selectedIndex="0" valueState="None" width="auto" editable="true" enabled="true" textDirection="Inherit"
										select="_onRadioButtonGroupSelect5">
										<buttons>
											<RadioButton text="Primary Terminal" editable="true" enabled="true" visible="true" width="auto" valueState="None" selected="false"/>
											<RadioButton text="Secondary terminal (s)" editable="true" enabled="true" visible="true" width="auto" valueState="None" selected="false"/>
										</buttons>
									</RadioButtonGroup>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Planned Plant" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<RadioButtonGroup
										id="sap_Responsive_Page_0-c813e6e4e80e22220f88a12c2_S2-content-build_simple_form_Form-1522924154302-formContainers-build_simple_form_FormContainer-1-formElements-build_simple_form_FormElement-3-fields-sap_m_RadioButtonGroup-1522924501452"
										columns="8" selectedIndex="0" valueState="None" width="auto" editable="true" enabled="true" textDirection="Inherit"
										select="_onRadioButtonGroupSelect7">
										<buttons>
											<RadioButton text="Yes" editable="true" enabled="true" visible="true" width="auto" valueState="None" selected="false"/>
											<RadioButton text="No" editable="true" enabled="true" visible="true" width="auto" valueState="None" selected="false"/>
										</buttons>
									</RadioButtonGroup>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="State" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None"
										maxWidth="100%">
										<items>
											<core:Item text="AL" enabled="true" key="AL"/>
											<core:Item text="CT" enabled="true" key="CT"/>
											<core:Item text="CA" enabled="true" key="CA"/>
											<core:Item text="DE" enabled="true" key="DE"/>
											<core:Item text="FL" enabled="true" key="FL"/>
											<core:Item text="GA" enabled="true" key="GA"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Terminal Location" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%"
										items="{path:'/TerminalServiceSet'}">
										<core:Item text="{Terminals}" enabled="true" key="{Plant}"/>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 1" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 2" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 3" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 4" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 5" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 6" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Material 7" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<ComboBox placeholder="Select one" editable="true" enabled="true" visible="true" width="400px" valueState="None" maxWidth="100%">
										<items>
											<core:Item text="Please Select one" enabled="true" key="Item"/>
										</items>
									</ComboBox>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="HiddenLabel" visible="false" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<Table id="carrierTable" width="800px" noDataText="No data" mode="None" showSeparators="All" growing="true" growingThreshold="5"
										growingScrollToLoad="true" backgroundDesign="Solid" class="sapUiSmallMarginTopBottom">
										<columns>
											<Column width="auto" hAlign="Center" vAlign="Top" minScreenWidth="Phone" demandPopin="true" popinDisplay="Inline" mergeDuplicates="false">
												<header>
													<Text text="Carriers" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
												</header>
											</Column>
											<Column width="auto" hAlign="Center" vAlign="Top" minScreenWidth="Tablet" demandPopin="true" popinDisplay="Inline" mergeDuplicates="false">
												<header>
													<Text text="FEIN Number" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
												</header>
											</Column>
											<Column width="auto" hAlign="Center" vAlign="Top" minScreenWidth="Tablet" demandPopin="true" popinDisplay="Inline" mergeDuplicates="false">
												<header>
													<Text text="SCAC Number" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
												</header>
											</Column>
											<Column width="auto" hAlign="Center" vAlign="Top" minScreenWidth="Tablet" demandPopin="true" popinDisplay="Inline" mergeDuplicates="false">
												<header>
													<Text text="Vendor Number" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
												</header>
											</Column>
										</columns>
										<items>
											<ColumnListItem id="carrierTableRow" type="Active">
												<cells>
													<Input id="cell1" type="Text" showValueHelp="true" valueHelpRequest="handleValueHelpCarrier" enabled="true" visible="true" width="auto"
														valueHelpOnly="false" maxLength="0" value="{Name1}"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0" value="{Lifnr}"/>
												</cells>
											</ColumnListItem>
											<ColumnListItem type="Active">
												<cells>
													<Input type="Text" showValueHelp="true" valueHelpRequest="handleValueHelpCarrier" enabled="true" visible="true" width="auto"
														valueHelpOnly="false" maxLength="0" value="{Name1}"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0" value="{Lifnr}"/>
												</cells>
											</ColumnListItem>
											<ColumnListItem type="Active">
												<cells>
													<Input type="Text" showValueHelp="true" valueHelpRequest="handleValueHelpCarrier" enabled="true" visible="true" width="auto"
														valueHelpOnly="false" maxLength="0" value="{Name1}"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0"/>
													<Input type="Text" showValueHelp="false" enabled="true" visible="true" width="auto" valueHelpOnly="false" maxLength="0" value="{Lifnr}"/>
												</cells>
											</ColumnListItem>
										</items>
									</Table>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="Additional Products" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<TextArea rows="2" cols="5" maxLength="0" wrapping="None" visible="true" width="700px"/>
								</form:fields>
							</form:FormElement>
							<form:FormElement visible="true">
								<form:label>
									<Label text="HiddenLabel" visible="false" design="Bold" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
								</form:label>
								<form:fields>
									<CheckBox id="addterminal" text="Add Terminal" selected="false" editable="true" enabled="true" visible="true" width="auto"
										textDirection="Inherit" select="onAddTerminalChecked"/>
								</form:fields>
							</form:FormElement>
						</form:formElements>
						<form:title/>
					</form:FormContainer>
				</form:formContainers>
				<form:layout>
					<form:ResponsiveGridLayout adjustLabelSpan="false" columnsL="1" labelSpanL="3" columnsM="1" labelSpanM="2" labelSpanS="12"/>
				</form:layout>
			</form:Form>

Existing Form and its element screenshot

0 个答案:

没有答案