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.
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);
}
Please note that
dataRequested
ofSmartTable
is being deprecated. Using e.g.oSmartTable.getTable().getBinding().attachDataReceived(function(e) {// check e.getParameter('data')})
will continue to work for longer...yes, it has been said use
beforeRebindTable
but I couldn't find out how to use it. Also in thebeforeRebindTable
of the smarttable thegetBinding("items")
of the table is undefined. We have to bind the event to the enclosed table after data requested.Why not use
oSmartTable.getTable().getBinding().attachDataReceived()
?We must use
oSmartTable.getTable().getBinding("items")
and notoSmartTable.getTable().getBinding()
as I used a table inside of the smart table. And the problem is both returnundefined
before the data is requested.