// Put this code into Control Display Template - only applies if you aren't editing the page
AddPostRenderCallback(ctx, function() {
if (!Srch.U.isPageInEditMode() && (ctx.DataProvider.get_totalRows() > 0)){
$(ctx.DataProvider._element).parentsUntil('.ms-webpart-zone').last().hide();
}
else {
$(ctx.DataProvider._element).parentsUntil('.ms-webpart-zone').last().show();
}
});
// Edit: added else condition. If you search on a result that has results and your search gives no results, the webpart hides. But if you search again with results for your search, the "else" shows your webpart again
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.