1
0
mirror of synced 2024-11-23 13:36:01 +03:00

remove dupe format no matches messages. fixes #1341

This commit is contained in:
Igor Vaynberg 2013-05-22 23:38:39 -07:00
parent 213d281ece
commit f1a5fe2c9e

View File

@ -1571,7 +1571,9 @@ the specific language governing permissions and limitations under the Apache Lic
} }
if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) { if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
if (results.find(".select2-no-results").length === 0) {
render("<li class='select2-no-results'>" + opts.formatNoMatches(search.val()) + "</li>"); render("<li class='select2-no-results'>" + opts.formatNoMatches(search.val()) + "</li>");
}
return; return;
} }
@ -2755,7 +2757,7 @@ the specific language governing permissions and limitations under the Apache Lic
//If all results are chosen render formatNoMAtches //If all results are chosen render formatNoMAtches
if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){ if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
if(!data || data && !data.more) { if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
this.results.append("<li class='select2-no-results'>" + self.opts.formatNoMatches(self.search.val()) + "</li>"); this.results.append("<li class='select2-no-results'>" + self.opts.formatNoMatches(self.search.val()) + "</li>");
} }
} }