question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sap.m.SearchField clear is running the search

See original GitHub issue

I’m using the sap.m.SearchField. When I click the (x) icon, it actually executes the search. Same result if I run the .clear() method on the control (which is not a documented method though).

I checked the control source, and it seems to be the intentional behaviour. But it seems odd to me and to my users.

sap.m.SearchField.prototype.clear = function(){
    if(!this._inputElement || this.getValue() == "") return;
    this.setValue("");
    this.fireLiveChange({newValue: ""});
    this.fireSearch({query: ""}); // <-----------why?
};

Currently I override the method in my controller as a workaround.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
r-murphycommented, Jan 20, 2018

We recently upgraded to UI5 1.50 and found that there is now a ‘clearButtonPressed’ parameter passed on the search event callback. And it’s documented too, so this is exactly what we needed and this issue can be closed. Thanks!

0reactions
flovogtcommented, Mar 18, 2021

This enhancement is already implemented with release 1.34. Therefore, closing this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sap.m.SearchField - API Reference - Demo Kit - SAPUI5 SDK
An input field to search for a specific item. Overview. A search field is needed when the user needs to find specific information...
Read more >
SearchField search or close button not triggering
Hi, I am using sap.m.searchfield in my xml view and trying to perform ... Search Press/Enter onSearch: function(oEvent) { // Catching Clear ......
Read more >
Search | SAP Fiori Design Guidelines
Use a search field ( sap.m.SearchField ) if you want to enable users to enter text to search for information. The search field...
Read more >
How to clear input field value on back - SAP Community
We can set empty value to the input fields when click on back button. ... check in the inspect element of chrome, by...
Read more >
How to clear/reset data in sap.ui.commons.searchfield
searchfield " control in "sap.ui.commons.dropdownbox" change event. I have tried below option but i am not able to succeed here. this.byId(" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found