使用openUI5在xml视图中访问多个模型 [英] Accessing multiple models in xml view with openUI5

查看:97
本文介绍了使用openUI5在xml视图中访问多个模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在控制器中,我用以下名称设置模型:

In my controller I'm setting my models with a name:

var oModel = new JSONModel();
oModel.setData({
    delimiterDRS1: " - ",
    dateValueDRS1: dateFrom,
    secondDateValueDRS1: dateTo,
    dateFormatDRS1: "dd/MM/yy"
});
oView.setModel(oModel, "dateRange");

在我的xml视图中,我已经尝试过

and in my xml view I've tried

<Text text="{dateRange>dateValueDRS1}"></Text>
<Text text="{/dateRange/dateValueDRS1}"></Text>

,但这些都不起作用.我什至尝试通过设置全局设置模型

and neither of those work. I've even tried to set the model globally by doing

sap.ui.getCore().setModel(oModel, "dateRange")

如果我未在setModel方法中指定模型名称,并尝试访问属性{/dateValueDRS1},它将起作用.我一直在寻找文档,但找不到任何文档.任何帮助将不胜感激.

If I don't specify a model name in the setModel method and try to access the attributes {/dateValueDRS1} it works. I've been looking for documentation but haven't been able to find any. Any help would be appreciated.

推荐答案

尝试使用"{dateRange>/dateValueDRS1}"读取属性. 您阅读它的方式将在相对路径下工作.查看文档主题 绑定路径 .

Try to read the property by using "{dateRange>/dateValueDRS1}". The way you read it, would work in a relative path. Check the documentation topic Binding Path.

这篇关于使用openUI5在xml视图中访问多个模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆