加载数据失败时,SAPUI5 SmartTable的事件是什么?

加载数据失败时,SAPUI5 SmartTable的事件是什么?,sapui5,Sapui5,当智能表无法从后端读取数据时,我需要运行代码。我必须向智能表中添加什么类型的事件 例如: oSmartTable.getBinding("items").attachEventOnce("dataFailed", .... 我们没有这样的活动,但我需要这样的活动 如果我们有一个SmartTable,里面有这样一个表,我们可以使用它的dataRequested事件: <smartTable:SmartTable ..... dataRequested="onDataRequested"&

当智能表无法从后端读取数据时,我需要运行代码。我必须向智能表中添加什么类型的事件

例如:

oSmartTable.getBinding("items").attachEventOnce("dataFailed", ....

我们没有这样的活动,但我需要这样的活动

如果我们有一个SmartTable,里面有这样一个表,我们可以使用它的
dataRequested
事件:

<smartTable:SmartTable .....  dataRequested="onDataRequested">
  <m:Table id="table" ...>
  ....
  </m:Table>
</smartTable:SmartTable>

以下是UI51.56中的一个简单解决方案

在你看来

<smartTable:SmartTable id="smartTable" entitySet="PRs" smartFilterId="smartFilterBar"
 tableType="ResponsiveTable" beforeRebindTable=".onBeforeRebind">

您是否尝试过使用表
绑定
dataReceived
事件,并检查
data
是否未定义(如果发生错误,则应未定义)。您需要遍历该表,即,
oSmartTable.getTable().getBinding().attachDataReceived(函数(e){//check e.getParameter('data')})
。是的,数据不会发送到那里。我找到了解决方案。请注意,
SmartTable
dataRequested
已被弃用。例如,使用oSmartTable.getTable().getBinding().attachDataReceived(函数(e){//check e.getParameter('data')})
将继续工作更长时间…是的,据说在重新绑定之前使用
,但我找不到如何使用它。此外,在smarttable的
beforerebind
中,该表的
getBinding(“items”)
未定义。我们必须在请求数据后将事件绑定到封闭的表中。为什么不使用
oSmartTable.getTable().getBinding().attachDataReceived()
?我们必须使用
oSmartTable.getTable().getBinding(“items”)
而不是
oSmartTable.getTable().getBinding()
,就像我在智能表中使用表一样。问题是在请求数据之前返回
未定义的
<smartTable:SmartTable id="smartTable" entitySet="PRs" smartFilterId="smartFilterBar"
 tableType="ResponsiveTable" beforeRebindTable=".onBeforeRebind">
onBeforeRebind: function (oEvent) {
  var mBindingParams = oEvent.getParameter("bindingParams");
  //Event handlers for the binding
  mBindingParams.events = {
    "dataReceived" : function(oEvent){
        var aReceivedData = oEvent.getParameter('data');
        },
        //More event handling can be done here
  };
}