Skip to Content

Cannot read property 'filter' of undefined when filtering sap.m.Input suggestion items

Hi,

I have an input with both value help and suggestion items. I'm applying filters when the suggest event triggers and getBinding("suggestionItems") returns undefined. Snippets of my code are listed below.

XML View

<Input id="search_TerrainLowerMID" suggest="onSuggestion" valueHelpRequest="onSelectf4" placeholder="" showSuggestion="true" showValueHelp="true" type="Text" suggestionItems="{d_TplnrFl>/}">
     <suggestionItems>
          <core:ListItem text="{d_TplnrFl>Key}" additionalText="{d_TplnrFl>Key} {d_TplnrFl>Value}" />
     </suggestionItems>
</Input>

Controller

onSuggestion: function(oEvent) {
                var value = oEvent.getParameter("suggestValue");
                var Filters = [];
                if (value) {
                    Filters.push(new sap.ui.model.Filter("Key", sap.ui.model.FilterOperator.StartsWith, value));
                }
                oEvent.getSource().getBinding("suggestionItems").filter(Filters);
            },

sap.ui.getCore().byId(oEvent.getSource().sId) works, but
oEvent.getSource().getBinding("suggestionItems") returns undefined. For some reason I am unable to get the binding of suggestionItems.

Value help and it's select dialog also work, just not suggestions.

Any help is appreciated, thank you!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 07, 2017 at 12:05 PM

    Hi Abdul,

    Have you found any solution to this one?

    If not, are you pushing it under some aggregation? What version on UI5 library are you using?

    Regards,

    Swaroop

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Swaroop,

      I wasn't able to solve this but I've since stopped pre-loading value help data and filtering it in the front-end. I now send suggested values to the back-end and load the filtered values in to the model which works well for me.