Skip to Content
0

How to catch the error if oDataModel binding done from XML view fails?

Sep 04, 2017 at 02:57 PM

50

avatar image
Former Member

Hello Experts,

I'm unable to figure out on how to display error message if there is a failure in oData Binding.

I know that we have methods ( error() and success() ) that we could use if we call the oData from the controller succeeds or fails. But how to display the error message to the user if the oData call from the XML view fails?

I'm using the following code in my XML View:

<Select items="{path: '/profileDetSet'}">
<core:Item key="{Profile}" text="{Description}"/>
</Select>

I've more than one Select and a table too in my View. How can we catch the error if the Binding fails for some reason from the backend?

Thanks & Regards,
Soundarya

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Akhilesh Upadhyay Sep 04, 2017 at 06:37 PM
0

you can try attaching below two events of your model where you are defining the model in your app,

attachRequestFailed or attachMetadataFailed as below,

oModel.attachRequestFailed(function(oEvent) {
  // using oEvent.getParameters() you can get error details
}, this);
oModel.attachMetadataFailed(function(oEvent) {
   // using oEvent.getParameters() you can get error details
}, this);

this will trigger if any request or metadata fails respectively.

Share
10 |10000 characters needed characters left characters exceeded