Skip to Content
0

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

May 12, 2017 at 07:30 AM

225

avatar image

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!

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

1 Answer

Swaroop Anasane Sep 07, 2017 at 12:05 PM
0

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

Show 1 Share
10 |10000 characters needed characters left 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.

0