如何在SAPUI5中使用XML从oData WS创建多个表单?

时间:2017-08-25 08:22:57

标签: sapui5

我想从odata绑定创建多个表单。

是否可以不在JS中生成表单?

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案,感谢sap.m.Table组件:

<Table items="{/NextList2ContentSet}"
    id="tList"
    mode="MultiSelect"
    visibleRowCount="10"
    width="90%">
     <columns>
           <Column width="5em"></Column>

     </columns>
     <items>
        <ColumnListItem>
          <cells>
             <form:Form width="100%" editable="true" visible="true">
              <form:formContainers>
                <form:FormContainer visible="true">
                  <form:formElements>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Text text="{Matnr}" width="1000px" maxLines="1" wrapping="true" textAlign="Begin" textDirection="Inherit"/>
                        <m:Text text="ST10/R2C/60.11.3E" width="auto" maxLines="3" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:fields>
                    </form:FormElement>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Text text="{Maktx}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                        <m:Text text="{ZvsolaTarget}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:fields>
                    </form:FormElement>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="Pick" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Input id="inputPicked" value="{ZvsolaTarget}" type="Number" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:fields>
                    </form:FormElement>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="SCRAP" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Input id="inputScrap" type="Number" text="1" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:fields>
                    </form:FormElement>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="Article" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Input id="articleInput" text="Article" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:fields>
                    </form:FormElement>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="Bin" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Input id="bin" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:fields>
                    </form:FormElement>
                    <form:FormElement visible="true">
                      <form:label>
                        <m:Label text="Reason" design="Standard" width="100%" required="false" textAlign="Begin" textDirection="Inherit"/>
                      </form:label>
                      <form:fields>
                        <m:Select id="catComboBox" change="onChangeCat" items="{ path: 'Glori>/ReasonCategorySet', sorter: { path: 'Zcat' } }">
                           <core:Item key="{Glori>Zcat}" text="{Glori>Zdesc}"/>
                         </m:Select>
                         <m:Select id="origComboBox" change="onChangeOrig" items="{ path: 'Glori>/ReasonOriginSet', sorter: { path: 'Zorig' } }">
                           <core:Item key="{Glori>Zorig}" text="{Glori>Zdesc}"/>
                         </m:Select>
                         <m:Select id="descComboBox" change="onChangeDesc" visible="{=${Glori>/ReasonCategorySet}.length > 0}"
                                                   items="{ path: 'Glori>/ReasonDescSet', sorter: { path: 'Zreason' } }">
                           <core:Item key="{Glori>Zreason}" text="{Glori>Zreasondesc}"/>
                         </m:Select>
                      </form:fields>
                    </form:FormElement>
                  </form:formElements>
                  <form:title/>
                </form:FormContainer>
              </form:formContainers>
              <form:layout>
                <form:ResponsiveGridLayout adjustLabelSpan="false" columnsL="2" labelSpanL="3" columnsM="1" labelSpanM="2" labelSpanS="12"/>
              </form:layout>
            </form:Form>
          </cells>
       </ColumnListItem>
      </items>
 </Table>