Skip to Content
author's profile photo Former Member
Former Member

Binding problem in Master Detail APP

Hello,

I'm currently working on a master detail APP and I'm having some issues with the item detail list. All the items in my mockdata file are displayed in the detail view regardless of header item key...

- My metadata.xml looks something like this (1 ProjectHeader -> * ProjectItems):

<EntityType Name="ProjectHeader" sap:content-version="1">
                <Key>
                    <PropertyRef Name="ProjectId"/>
                </Key>
                <Property Name="ProjectId" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Project"/>
                <NavigationProperty Name="ProjectItems" Relationship="PROJECTINFOXX.ProjectHeader_ProjectItems" FromRole="FromRole_ProjectHeader_ProjectItems"                          ToRole="ToRole_ProjectHeader_ProjectItems"/>
            </EntityType>
            <EntityType Name="ProjectItem" sap:content-version="1">
                <Key>
                    <PropertyRef Name="ProjectId"/>
                    <PropertyRef Name="Item"/>
                </Key>
                <Property Name="ProjectId" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Project"/>
                <Property Name="Item" Type="Edm.String" Nullable="false" MaxLength="6" sap:label="Item"/>
                <Property Name="Description" Type="Edm.String" MaxLength="40" sap:label="Description"/>
                <NavigationProperty Name="ProjectHeader" Relationship="PROJECTINFOXX.ProjectItem_ProjectHeader" FromRole="FromRole_ProjectItem_ProjectHeader"                          ToRole="ToRole_ProjectItem_ProjectHeader"/>
</EntityType>

- In my ProjectHeader.json I have this:

[{
  "ProjectId": "ProjectId A",
  "__metadata": {
  "uri": "ProjectHeaders('ProjectId A')",
  "type": "PROJECTINFOXX.ProjectHeader"
  },
  "ProjectItems": {
  "__deferred": {
  "uri": "ProjectHeaders('ProjectId A')/ProjectItems"
  }
  },
}, {
  "ProjectId": "ProjectId B",
  "__metadata": {
  "uri": "ProjectHeaders('ProjectId B')",
  "type": "PROJECTINFOXX.ProjectHeader"
  },
  "ProjectItems": {
  "__deferred": {
  "uri": "ProjectHeaders('ProjectId B')/ProjectItems"
  }
  },
}]

In my ProjectItem.json I have this:

[{
  "ProjectId": "ProjectId A",
  "Item": "1",
  "Description": "Test Description 1"
}, {
  "ProjectId": "ProjectId A",
  "Item": "2",
  "Description": "Test Description 2"
}]

- So ProjectID A contains two items and ProjectID B does not contain items but when I select ProjectID B in my APP the 2 Project Items are displayed...

In my detail view I'm defining my item list like so:

<List id="Project Items"
      items="{path: 'ProjectItems',
                  parameters: {select: 'ProjectId, Description'}}">

    <StandardListItem
      title="{Description}"
      iconDensityAware="false"
      iconInset="false" 
      />
  </List>

It seems that the context is not updated when I change my Master Item selection, all the detail items are always displayed.

Any help would be most appreciated.

Thank you.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on May 12, 2015 at 05:03 PM

    Hi Miguel,

    I faced the same issue.

    Following tips solved the issue.

    adding the link also. You need to download mock-data-navigation.pdf and see. In case you are not able to open the link, you can see the text below:

    For a general explanation, please check the official OpenUI5

    documentation:

    (https://openui5.hana.ondemand.com/#docs/guide/c9a91ddaef47461c9c

    44bfc2198ea3f0.html)

    #9: Is OData navigation supported?

    The mock server supports navigation via association also if no referential

    constraint is defined. However, the result of the navigation is the entire

    collection of the navigation, or the first entry of the collection according to the

    association multiplicity. So, if you want the navigation to return "correct" results

    according to keys, define a respective referential constraint.

    Note

    Due to a limitation of the mock server, you can not use the same association

    to describe a two-­way navigation. If the navigation shall work for both

    directions, you need to define an appropriate association for each direction.

    Here is an example of a Referential Constraint in the metadata.xml of the

    OData service:

    <Association Name="ProductsSupplier" sap:content-version="1">

    <End Type="EPM_REF_APPS_SHOP.Supplier" Multiplicity="1" Role="FromRole_ProductsSupplier"/>

    <End Type="EPM_REF_APPS_SHOP.Product" Multiplicity="*" Role="ToRole_ProductsSupplier"/>

    <ReferentialConstraint>

    <Principal Role="FromRole_ProductsSupplier">

    <PropertyRef Name="Id"/>

    </Principal>

    <Dependent Role="ToRole_ProductsSupplier">

    <PropertyRef Name="SupplierId"/>

    </Dependent>

    </ReferentialConstraint>

    </Association>

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.