Skip to Content
avatar image
Former Member

search function is not working in master view


I created a list in master view and trying to create a search function but it is not working. Couldn't find any error in it. Please help.

This is my code




onSearch : function (evt) {
        // create model filter
        var filters = [];
        var query = evt.getParameter("query");
        if (query && query.length > 0) {
            var filter = new sap.ui.model.Filter("Swapn", sap.ui.model.FilterOperator.Contains, query);

        // update list binding
        var list = this.getView().byId("SwapList");
        var binding = list.getBinding("items");

and I set the Swapn as filterable in the OData

capture111.png (5.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jul 10, 2017 at 04:09 AM

    Try to use the search event instead of the livechange.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 10, 2017 at 06:35 AM

    Are you using OData model or JSON model to bind to your list UI? If it is OData model then the above code won't work. This works only for client side model which a JSON model is.

    Add comment
    10|10000 characters needed characters exceeded

    • For OData model you will have to handle the search/filter functionality in your OData service and not in the SAPUI5 app. You can only use the filter function at client side (i.e. in the UI5 app) if you use a JSON model.