Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
583 views
in Technique[技术] by (71.8m points)

sapui5 - Writable OData V2 service from odata.org: "Products" from an expanded Entity not visible

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...