I have a page with the SXA search result component. I want to refresh the search result on the click of a button. Please let me know if it is possible.



The easiest way is to update hash in the URL (search parameters)

Search Results will reload once hash parameter in the URL will change.

You can do it like this

window.location.hash = "foo=1"

You can add parameter that does nothing like I did and increment its value. To trigger it again you will have to assign different value ("foo=2").

If you have other search renderings on a page which add their own parameters to the hash you will have to fetch current value, modify it and then assign.

  • Thanks a lot for your help!! It is working .But in the page I have 2 search result component, the 2nd one is getting empty while the 1st one is refreshed please suggest.How can i know which hash to use for 2nd one? Nov 5 '20 at 16:54
  • Can i use the searchresultsignature? Nov 5 '20 at 17:04
  • Assuming that your search configuration is correct (signatures) you don't have to worry about parameters, you just have to update 'fake' parameter and that's it Nov 5 '20 at 19:34
  • As I said it is making the 2nd search results blank Nov 6 '20 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.