0
votes

I develop a little demo application with SAP Netweaver Gateway OData as a backend and SAPUI5 1.44 as UI. I am facing a problem with expanding data with the OData v2 model.

My OData service has 3 entity sets: INDSet, INFSet and INDINFSet. INDSet has a 1:N navigation to INDINFSet, so I'm able to get all INDINFs for particular IND via the following URL:

/sap/opu/odata/SAP/ZGW_ODATA_TEST_SRV/INDSet('IND0000001')/INDINFSet

My UI consists of 2 views:

  • master view: only has one table.
  • detail view: a form which I display as a dialog screen. The form has fields of the IND entity and a table which contains INDINFSet records.

The problem is that there is no data on detail view - neither in master entity fields, nor in details table. I don't see any requests in "Network" tab of Chrome dev tools when I open Dialog form - neither on mock server, nor on NW Gateway backend.

Here is a code in master controller which opens the form dialog:

var tbl = this.getView().byId('IndsTable');
var ctx = tbl.getContextByIndex(tbl.getSelectedIndex());
var oData = ctx.getProperty(ctx.sPath);
var sContentDensityClass = this.getOwnerComponent().getContentDensityClass();
var oView = this.getView();
var controller = sap.ui.controller("demo.modules.indform.controller.IndFormDialog");
controller._indFormDialog = oView.byId('IndFormDialog');
if (!controller._indFormDialog) {
    controller._indFormDialog = sap.ui.xmlfragment(oView.getId(),
        'demo.modules.indform.view.IndFormDialog', controller);
    jQuery.sap.syncStyleClass(sContentDensityClass, oView,
         controller._indFormDialog);
    oView.addDependent(controller._indFormDialog);
}
oView.bindElement({
    path: sPath,
    model: 'mInd'
});
controller.openDialog(oView);

And here is the dialog itself:

<core:FragmentDefinition
  xmlns="sap.m"
  xmlns:mvc="sap.ui.core.mvc"
  xmlns:l="sap.ui.layout"
  xmlns:f="sap.ui.layout.form"
  xmlns:t="sap.ui.table"
  xmlns:fb="sap.ui.comp.filterbar"
  xmlns:core="sap.ui.core">
  <Dialog
    id="IndFormDialog"
    contentWidth="44rem"
    contentHeight="49rem"
    class="sapUiNoContentPManageing"
    showHeader="false"
    verticalScrolling="false"
    >
      <content>
        <f:SimpleForm
          class='IndForm'
          id="IndForm"
          maxContainerCols="2"
          editable="false"
          layout="ResponsiveGridLayout"
          labelSpanL="12"
          labelSpanM="12"
          labelSpanS="12"
          emptySpanL="0"
          emptySpanM="0"
          emptySpanS="0"
          columnsL="2"
          columnsM="2"
          columnsS="2">
          <f:content>
            <core:Title/>
            <Label text="Index code" />
            <Input
              type="Text"
              value="{mInd>/Id}"
            />
            <Label text="Index name" />
            <Input
              type="Text"
              value="{mInd>/Sname}"
            />
            <Label text="Actual till" />
            <DatePicker

              value="{mInd>/Eusdt}"
              />
          </f:content>
        </f:SimpleForm>

        <t:Table
          id="Infosystems"
          rows="{mInd>INDINFSet}"
          visibleRowCount="10"
          visibleRowCountMode="Auto"
          selectionMode="None"
          enableSelectAll="false"
          ariaLabelledBy="title"
          >
          <t:toolbar>
            <Toolbar>
              <Title
                id="infosystableTitle"
                text="Infosystems"
                level="H3"/>
            </Toolbar>
            <Button
              icon="sap-icon://add"
              tooltip="Add record"
              press="addInfosystem" >
              <layoutData>
                <OverflowToolbarLayoutData priority="NeverOverflow" />
              </layoutData>
            </Button>
          </t:toolbar>
          <t:columns>

             <t:Column>
              <Label text="Infosystem"/>
              <t:template>
              <ComboBox
                items="{
                    path: 'mInfs>/INFSet',
                    sorter: { path: 'Name' },
                    templateShareable: true
                  }"
                >
                <items>
                  <core:Item key="{mInfs>Id}" text="{mInfs>Name}" selectedKey="{mInd>Infosys}"/>
                </items>
              </ComboBox>
              </t:template>
            </t:Column>

            <t:Column
              width="5em">
              <Label text="Is source"/>
              <t:template>
                <CheckBox selected="{mInd>IsSrc}" />
              </t:template>
            </t:Column>
          </t:columns>
        </t:Table>

      </content>
    <buttons>
      <Button
        id="IndFormDialogButtonSave"
        text="Save"
        type="Accept"
        press="onPressSave" />
      <Button
        id="IndFormDialogButtonCancel"
        text="Close"
        type='Reject'
        press="onPressCancel" />
    </buttons>
  </Dialog>
</core:FragmentDefinition>
1

1 Answers

0
votes

Could you try this? Let me know afterwards...

oView.bindElement({ 
  path: sPath, 
  model: 'mInd', 
  parameters: {expand:'INDINFSet'}
});