Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add XML Fragment to XML View?

Tags:

sapui5

I create a fragment with following content:

<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>  

And the views file structure looks as following:

enter image description here

I read in the Wakthrough step about how to integrate a fragment in controller but I want to use fragment directly in the view. Is it possible?

like image 770
softshipper Avatar asked Jan 02 '23 10:01

softshipper


1 Answers

Do you mean like this?

<core:Fragment fragmentName="mynamespace.view.ViewCreate" type="XML" />

like image 172
Graham Robbo Avatar answered Mar 12 '23 07:03

Graham Robbo