-1

Using this writable OData v2 sample service (not Northwind), I'm binding a single Category entity to a container control while expanding to the entity set Products. Inside the container control, I have a list which has an aggregation binding to the items with the products coming from the expand.

<Page binding="{
  path: 'odataModel>/Categories(1)',
  parameters: {
    expand: 'Products'
  }
}">
  <List items="{odataModel>Products}">
    <StandardListItem title="{odataModel>Name}" />
  </List>
</Page>

The problem is that the list doesn't show the names of the products, although I get the correct length of the collection. And there are no error messages either.

Result of products from an expanded entity

Here is the example implementing the sample OData service: https://embed.plnkr.co/bC2KPe/.

Weirdly, the binding path of each item is reported as "/[object Object]" instead of something like "/Products(1)".


The properties of the products are visible if...

  • I do the same with the Northwind service instead, which is readable only (But what I need is a writable service)
  • I bind the products directly to the list without the parent's element binding.
  • I delete a single product (e.g. manually "/Products(0)" as it can be seen in the plunker example). After that, the product names are visible.

What's wrong with this sample service? Do I have to configure my ODataModel according to that service specifically? Is it just the service that is not working properly?

Also I wanted to replace Products with a different entity set but all the other entity sets (Suppliers and Categories) navigate to Products only.

Is there any other free writable sample OData V2 service I can test?

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170

2 Answers2

1

I see that the resulting structure on odata.svc is not as expected in the service. The resulting structure is missing the 'results' parameter. If you see the northwind service, it has the 'results' parameter.

krisho
  • 1,004
  • 7
  • 26
  • Thanks for pointing this our! Indeed, it seems to be the main problem. I ran the service in a mock server with the exact same mock data which didn't have the `"results"` property as you said. Only then, UI5 complained "The mock data format for entity set [...] invalid". After wrapping the mock data in the `"results"` property, everything worked fine. So I tried to force the service to add `"results"` by adding `InlineRepeat` as a `countMode` but this applies only to a parent as a collection and not for the child entities (Products). Northwind has `"results"` even for the child entities. – Boghyon Hoffmann May 02 '17 at 09:50
  • It's [working now](https://stackoverflow.com/a/50161883/5846045) with the newer version – Boghyon Hoffmann May 22 '18 at 18:23
  • Adding related github issue for other readers: https://github.com/OData/ODataSamples/issues/119#issuecomment-524761871 – Boghyon Hoffmann Nov 10 '19 at 17:17
0

As of version 1.52.1, the ODataModel (v2) can handle broken service implementation as well:

Since 1.52.1

E.g. the above service is missing the results parameter as indicated by krisho.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170