SAPUI5 Search Field Suggestion Autocomplete

前端 未结 1 1090
有刺的猬
有刺的猬 2021-01-22 10:56

I am developing an SAPUI5 application. What I want to achieve is to have a suggestion list autocomplete in my search field. For example when I type \"app\", I will list suggesti

相关标签:
1条回答
  • 2021-01-22 11:32

    There's a timing issue with the odata service and the suggestion pop up. It's caught me out before as well. Technically, the suggestion box opens before the oData finishes, which is why the example code works - it's a JSON model. My solution looks something like this

     var search = this.byId('searchField');
     var binding = search.getBinding("suggestionItems");
    
     binding.filter(filters);
     binding.attachEventOnce('dataReceived', _ => search.suggest());
    
    0 讨论(0)
提交回复
热议问题