简体   繁体   English

SAPUI5中元素绑定中的元素绑定

[英]Element Binding in Element Binding in SAPUI5

I'm using element binding in XML to get data from an OData service in the controller:我在 XML 中使用元素绑定从 controller 中的 OData 服务获取数据:

{myModel2>/oData/ProdOrdSet('123456789')/Gmein}

The whole thing should now work with dynamic numbers instead of 123456789 .整个事情现在应该使用动态数字而不是123456789 I started with the following approach:我从以下方法开始:

{myModel2>/oData/ProdOrdSet('{myModelLD>/Aufnr}')/Gmein}

So another JSON Model and another element in the first.所以另一个 JSON Model 和第一个中的另一个元素。 Unfortunately this did not work, kindly help?不幸的是,这不起作用,请帮忙?

Try to get the ID in a local variable and form the binding path to bind.尝试在局部变量中获取 ID 并形成要绑定的绑定路径。 Instead of this而不是这个

{myModel2>/oData/ProdOrdSet('{myModelLD>/Aufnr}')/Gmein}

try binding as below:尝试如下绑定:

var id = getModel("myModelLD").getProperty("/Aufnr");
var sPath = "myModel2>/oData/ProdOrdSet('"+id+"')/Gmein";
this.getView().bindElement(sPath);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM