Added the ability to pass ngShow to the SearchWidget generator helper. By specifying this parameter we can control when the search bar gets shown. In this case we want to hide the search bar when a list is empty to start with.

This commit is contained in:
Michael Abashian 2016-01-27 10:14:18 -05:00
parent 56d0cbfeff
commit 64f4cb03e7
2 changed files with 11 additions and 1 deletions

View File

@ -1658,7 +1658,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += SearchWidget({
iterator: collection.iterator,
template: collection,
mini: true
mini: true,
ngShow: collection.iterator + "Loading == true || " + collection.iterator + "_active_search == true || (" + collection.iterator + "Loading == false && " + collection.iterator + "_active_search == false && " + collection.iterator + "_total_rows > 0)"
});
html += "<div class=\"col-lg-8\">\n";

View File

@ -632,6 +632,7 @@ angular.module('GeneratorHelpers', [systemStatus.name])
form = params.template,
size = params.size,
includeSize = (params.includeSize === undefined) ? true : params.includeSize,
ngShow = (params.ngShow) ? params.ngShow : false,
i, html = '',
modifier,
searchWidgets = (params.searchWidgets) ? params.searchWidgets : 1,
@ -667,6 +668,10 @@ angular.module('GeneratorHelpers', [systemStatus.name])
html += "\" id=\"search-widget-container" + modifier + "\">\n";
}
if(ngShow) {
html += "<div ng-show=\"" + ngShow + "\">";
}
html += "<input id=\"search_value_input\" type=\"text\" ng-hide=\"" + iterator + "SelectShow" + modifier + " || " +
iterator + "InputHide" + modifier + "\" " +
"class=\"form-control List-searchInput\" ng-model=\"" + iterator + "SearchValue" + modifier + "\" " +
@ -688,6 +693,10 @@ angular.module('GeneratorHelpers', [systemStatus.name])
html += "<div id=\"search-widget-spacer\" ng-show=\"" + iterator + "SelectShow" + modifier + "\"></div>\n";
if(ngShow) {
html += "</div>";
}
if (includeSize) {
html += "</div>\n";
}