Monday, 21 April 2014

If you have multiple search webparts how to show only one "Nothing here matches your search"

If you have multiple search webparts how to show only one "Nothing here matches your search"
Open Control_Searchresult.html
Search for " <div id="NoResult">"
Change div id ex: <div id="Sr1">
Apply a class
Change div id ex: <div id="Sr1" class="Hide">
Ex: Hide
.Hide{display:none;}
Same way add for another Control_Searchresult.html
Change div id ex: <div id="Sr2">
Apply a class
Change div id ex: <div id="Sr2" class="Hide">
Now open 3rd Control_Searchresult.html
Search for <div id="NoResult">
you will find ....
if((ctx.ClientControl.get_shouldShowNoResultMessage())
if((ctx.ClientControl.get_shouldShowNoResultMessage())&&($("#Sr1").prop('class')=="Hide")&&($("#Sr2").prop('class')=="Hide")){
Now you will able to see only one message with..."Nothing here matches your search"