cancel
Showing results for 
Search instead for 
Did you mean: 

OData Filter is working but want to provide custom message...any help

Dheerendra
Participant
0 Kudos

Hi All,

I have applied a model filter in my UI5 code for display 'EQ' value in table based on user input and it is working. But i want to provide a custom message when that value doesn't exists in OData Model. Below is my code...please advice.

var aFilter = [];

var sQuery = mResult.text;

if (sQuery !== "") {

aFilter.push(new Filter("ProductID", FilterOperator.EQ, sQuery)); // I need to display a custom message when input value doesn't match with 'ProductID' in Odata.

var oTable2 = that.getView().byId("tableId");

var oBinding = oTable2.getBinding("items");

oBinding.filter(aFilter); that.getValues();

}else

{

sap.m.MessageToast.show("Please Enter correct value");

}

Thanks

Dheerendra

View Entire Topic
qmacro
Developer Advocate
Developer Advocate
0 Kudos

Just a fly-by suggestion: If the value doesn't exist in the OData model, I'm interpreting from that, that there are no matches based on the product ID entered. It might be an idea to have a message showing what you need to show, but initially not visible. Bind the visibility to a formatter that has access to the items you're fetching, and set the value according to how many there are (ie set visible to true if there are no items).

Dheerendra
Participant
0 Kudos

Thanks DJ for suggestions.. will look into this.