1
0
mirror of synced 2025-02-09 16:49:24 +03:00

Merge pull request #2055 from mac2000/feature-request-search-input-placeholder

Optional Search Input Placeholder parameter added
This commit is contained in:
Kevin Brown 2014-01-21 05:27:32 -08:00
commit 9cb18478a5

View File

@ -800,6 +800,7 @@ the specific language governing permissions and limitations under the Apache Lic
opts.element.prop("autofocus", false); opts.element.prop("autofocus", false);
if (this.autofocus) this.focus(); if (this.autofocus) this.focus();
this.search.attr("placeholder", opts.searchInputPlaceholder);
}, },
// abstract // abstract
@ -2274,7 +2275,7 @@ the specific language governing permissions and limitations under the Apache Lic
if (noHighlightUpdate !== false) { if (noHighlightUpdate !== false) {
if (initial === true && selected >= 0) { if (initial === true && selected >= 0) {
// By default, the selected item is displayed inside the result list from a single select // By default, the selected item is displayed inside the result list from a single select
// User can provide an implementation for 'hideSelectionFromResult' and hide it // User can provide an implementation for 'hideSelectionFromResult' and hide it
if(this.opts.hideSelectionFromResult !== undefined && selectedElm !== null) { if(this.opts.hideSelectionFromResult !== undefined && selectedElm !== null) {
if(this.opts.hideSelectionFromResult(selectedElm)) if(this.opts.hideSelectionFromResult(selectedElm))
selectedElm.addClass("select2-selected"); selectedElm.addClass("select2-selected");
@ -3328,7 +3329,8 @@ the specific language governing permissions and limitations under the Apache Lic
adaptContainerCssClass: function(c) { return c; }, adaptContainerCssClass: function(c) { return c; },
adaptDropdownCssClass: function(c) { return null; }, adaptDropdownCssClass: function(c) { return null; },
nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; }, nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
hideSelectionFromResult: function(selectedObject) { return undefined; } hideSelectionFromResult: function(selectedObject) { return undefined; },
searchInputPlaceholder: ''
}; };
$.fn.select2.ajaxDefaults = { $.fn.select2.ajaxDefaults = {