Warm tip: This article is reproduced from serverfault.com, please click

What is the event for SAPUI5 SmartTable when loading data is failed?

发布于 2018-10-08 15:14:46

I need to run a code when the smart table cannot read the data from back-end. What kind of event I have to add to the smart table?

For example something like:

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

We don't have such an event, but I need something like this.

Questioner
MJBZA
Viewed
0
MJBZA 2018-10-09 17:37:10

If we have a SmartTable with a table inside like this, we can use its dataRequested event:

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

By using this event we try to add dataReceived event of the table:

onDataRequested: function(oEvent){
    var oTable =  this.byId("table");
    oTable.getBinding("items").attachEventOnce("dataReceived",function(oData) {
        if(!oData.getParameter("data")){
            // Do something here        
        }
    }, this);
}