1
0
mirror of synced 2024-11-22 13:06:08 +03:00

resize the search field to full width when placeholder is set. fixes #53

This commit is contained in:
Igor Vaynberg 2012-05-02 09:26:00 -07:00
parent 2aeb3d5bd5
commit 5f00dd1cfd

View File

@ -1177,11 +1177,12 @@
clearSearch: function () { clearSearch: function () {
var placeholder = this.getPlaceholder(); var placeholder = this.getPlaceholder();
this.search.val("").width(10);
if (placeholder !== undefined && this.getVal().length === 0) { if (placeholder !== undefined && this.getVal().length === 0) {
this.search.val(placeholder).addClass("select2-default"); this.search.val(placeholder).addClass("select2-default");
this.resizeSearch(); // stretch the search box to full width of the container so as much of the placeholder is visible as possible
this.search.width(this.getContainerWidth());
} else {
this.search.val("").width(10);
} }
}, },