gpt4 book ai didi

sapui5 - 绑定(bind)完成后执行 Action

转载 作者:行者123 更新时间:2023-12-04 21:52:03 25 4
gpt4 key购买 nike

我编写了这部分来将 OData 信息与选择 Controller 绑定(bind):

var countrItems = new sap.ui.core.ListItem();
countrItems.bindProperty("key", "Land1");
countrItems.bindProperty("text", "Landx");
var CountrSelect = this.byId("CountrySelect");
CountrSelect.setModel(oModelTriptab);
CountrSelect.bindItems("/Countries", countrItems);

我想在绑定(bind)完成后执行一个操作(我想选择一些可以动态更改的默认值)。

最佳答案

将处理程序附加到 Binding 提供的事件 :

<Select items="{
path: '/Countries',
events: {
dataRequested: '.onCountriesRequested',
dataReceived: '.onCountriesReceived',
change: '.onCountriesChange'
}
}">
这些事件不仅可以应用于 ListBindings,还可以应用于所有绑定(bind)。 注: PropertyBindings 做 不是 触发任何请求,所以没有 dataRequesteddataReceived为他们。

I would like to perform an action after the binding is complete.


在这种情况下,您可以将处理程序附加到 change dataReceived 要通知有关“完成”绑定(bind)的事件。
与将处理程序附加到 requestCompleted 相比,上述方法更具描述性,最重要的是,绑定(bind)特定。

列表,m.Table,m.Tree,...
或者,UI5 提供事件 updateFinished 对于源自 sap.m.ListBase 的控件.它类似于 change事件,但提供更多信息,例如附加 "Growing"条目的原因、实际和总数。
<List
updateFinished=".onCountriesUpdateFinished"
items="..."
>
onCountriesUpdateFinished: function(event) {
const reasonForUpdate = event.getParameter("reason"); // "Refresh", "Growing", "Filter", "Sort", "Context", ...
const currentlyLoadedNumberOfCountries = event.getParameter("actual");
const totalNumberOfCountries = event.getParamter("total") // Value of $count
// ...
}

关于sapui5 - 绑定(bind)完成后执行 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29770332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com