Sapui5 按下按钮后设置忙指示灯
我有一个简单的场景,按下一个按钮,执行onSearchExisting函数。在函数中,我打开一个对话框,其中包含一个表。我在onSearchExisting函数中获取的表的数据。由于数据获取需要一些时间,我想将触发此功能的按钮设置为busy。 函数中的代码如下所示:Sapui5 按下按钮后设置忙指示灯,sapui5,Sapui5,我有一个简单的场景,按下一个按钮,执行onSearchExisting函数。在函数中,我打开一个对话框,其中包含一个表。我在onSearchExisting函数中获取的表的数据。由于数据获取需要一些时间,我想将触发此功能的按钮设置为busy。 函数中的代码如下所示: onSearchExisting : function() { var oButton = this.getView().by
onSearchExisting : function() {
var oButton = this.getView().byId("searchButton");
oButton.setBusy(true);
oButton.setBusyIndicatorDelay(0);
var oView = this.getView();
var oDialog = oView.byId("dialog2ID");
if (!oDialog) {
oDialog = sap.ui.xmlfragment(oView.getId(),"xxx.view.fragment.SearchExisting",this);
oView.addDependent(oDialog);
}
var oDataModel = new
sap.ui.model.odata.ODataModel("/sap/opu/odata/xxxx", true);
this.getView().byId("tableSearchFrgId").getBinding("items");
oButton.setBusy(false);
oDialog.open();
},
按钮未设置为忙碌,当我按下它时,我做错了什么?绑定是异步进行的,因此
oButton.setBusy(false)
将在oButton.setBusy(true)之后立即执行代码>
我建议您使用绑定的'dataReceived'事件并编写oButton.setBusy(false)此事件的事件处理程序中的代码>
在这里阅读更多 绑定是异步进行的,因此oButton.setBusy(false)
将在oButton.setBusy(true)之后立即执行代码>
我建议您使用绑定的'dataReceived'事件并编写oButton.setBusy(false)此事件的事件处理程序中的代码>
在这里阅读更多 执行setBusy(false)语句时,只经过了几毫秒。您应该将此语句放入oData调用的success函数中
oData调用是异步的,因此即使尚未检索到数据,下一行也会立即执行。执行setBusy(false)语句时,只过了几毫秒。您应该将此语句放入oData调用的success函数中
oData调用是异步的,所以即使尚未检索数据,下一行也会立即执行