sapui5 - 如何从外部获取 sap.m.Select 的 selectedKey?
问题描述
拥有此选择控件:
new Select("id", {
items: {
path: "/cards",
template: new ListItem({
key: "{Kunnr}",
text: "{Descrip}"
}),
},
});
我需要它能够获取它的选定键,但不能在更改事件中。我从外面需要它(另一个功能)。
我曾尝试使用该 ID,但我只是得到undefined
了结果。
解决方案
selectedKey
尝试使用有助于保持 MV* 模式的双向数据绑定。
new Select({
selectedKey: "{/selectedCard}" // <-- It's TwoWay
items: {
path: "/cards",
template: new ListItem({
key: "{Kunnr}",
text: "{Descrip}"
}),
},
});
我假设默认模型可以跨应用程序访问。因此,只要您可以访问该模型,您就可以通过myModel.getProperty("/selectedCard");
推荐阅读
- dialog - 如何在 Choregraphe 中旧对话的对话之后开始新对话?
- https - Google 网站管理员主站点版本 https://non-www 但收到带有 http://www 版本的“幻影”结果
- python - 转换为类或作为模块导入的 Python 脚本执行速度慢得多?
- c++11 - 如何在c ++中获取指向std :: set头的指针
- javascript - 使用破折号更新实时烛台图时遇到问题
- .net - 让 DataAdapter 获取新版本的修改表
- javascript - 使用 ng-sidebar 作为 sidenav
- powershell - 安装 posh-git 时遇到问题
- android - 无法使用 Kotlin 将消息写入文件
- apache - Apache 上的 301 重定向:与 HTTP 冲突 => HTTPS 重写规则