当前位置: 动力学知识库 > 问答 > 编程问答 >

odata - URL parameter as property binding

问题描述:

Is it possible to use a URL parameter as a property binding in UI5?

My problem is that I want to have different OData collections placed in the same UI5 aggregation. For example let's say I've "/Car("Mustang")/parts" and "/Car("Whatever")/parts". Both of them can be placed in the same view.

The application's URL contains the keyword like http://something/#/carMustang. This URL is coming from a routing pattern like "car{carHandle}".

How am I supposed to do stuff like this:

<List items="{/Car({carHandle})/parts}">

<StandardListItem title={someProperty}>

</StandardListItem>

</List>

So what would be the best practice to do this? I would like to avoid nasty fiddles in the controller.

网友答案:

In your view:

<List id="parts" items="{parts}">
   <StandardListItem title="{someProperty}"/>
</List>

In your controller code which reacts on matched routes:

var carHandle = event.getParameter("carHandle");
this.byId("parts").bindObject("/Car/" + carHandle);
分享给朋友:
您可能感兴趣的文章:
随机阅读: