如何将XML片段添加到XML视图?

时间:2018-05-09 09:58:55

标签: sapui5

我创建了一个包含以下内容的片段:

<core:FragmentDefinition
  xmlns="sap.m"
  xmlns:core="sap.ui.core"
>
  <f:SimpleForm
    title="Address"
    editable="true"
    layout="ResponsiveGridLayout"
    columnsM="2"
  >
    <Label text="Customer"></Label>
    <Input>
      <layoutData>
        <l:GridData span="XL4 L4 M12 S12"/>
      </layoutData>
    </Input>
    <Label text="PO reference">
      <layoutData>
        <l:GridData span="XL1 L1 M12 S12"/>
      </layoutData>
    </Label>
    <Input>
      <layoutData>
        <l:GridData span="XL4 L4 M12 S12"/>
      </layoutData>
    </Input>
    <Label text="PO date"></Label>
    <Input>
      <layoutData>
        <l:GridData span="XL4 L4 M12 S12"/>
      </layoutData>
    </Input>
    <Label text="Recipient">
      <layoutData>
        <l:GridData span="XL1 L1 M12 S12"/>
      </layoutData>
    </Label>
    <Input>
      <layoutData>
        <l:GridData span="XL4 L4 M12 S12"/>
      </layoutData>
    </Input>
    <Label text="Incoterms"></Label>
    <Input>
      <layoutData>
        <l:GridData span="XL4 L4 M12 S12"/>
      </layoutData>
    </Input>
  </f:SimpleForm>
  <Table id="orderItemTable" inset="false">
    <columns>
      <Column>
        <Text text="No."/>
      </Column>
      <Column
        minScreenWidth="Desktop"
        demandPopin="true"
        hAlign="End"
      >
        <Text text="Customer"/>
      </Column>
      <Column
        minScreenWidth="Desktop"
        demandPopin="true"
        hAlign="End"
      >
        <Text text="Sales Org."/>
      </Column>
      <Column
        minScreenWidth="Desktop"
        demandPopin="true"
        hAlign="Center"
      >
        <Text text="Distribution"/>
      </Column>
      <Column hAlign="End">
        <Text text="Division"/>
      </Column>
    </columns>
    <ColumnListItem>
      <cells></cells>
    </ColumnListItem>
  </Table>
</core:FragmentDefinition>  

视图文件结构如下所示:

enter image description here

我在Wakthrough step中读到了如何在控制器中集成片段,但我想在视图中直接使用片段。有可能吗?

1 个答案:

答案 0 :(得分:3)

你的意思是这样吗?

append