Merge branch 'ent-7850-12225-Añadir-buscador-para-agentes-en-wizard-report' into 'develop'
implemented text search of select inputs See merge request artica/pandorafms!4831
This commit is contained in:
commit
8fcdb59ae8
|
@ -2027,3 +2027,33 @@ function inArray(needle, haystack) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter selector item by text based on a text input.
|
||||
*
|
||||
* @param {string} textbox Text input.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
$.fn.filterByText = function(textbox) {
|
||||
var select = this;
|
||||
|
||||
$(textbox).bind("change keyup", function() {
|
||||
var search = $.trim($(textbox).val());
|
||||
var regex = new RegExp(search, "gi");
|
||||
|
||||
$(select)
|
||||
.find("option")
|
||||
.each(function() {
|
||||
if (
|
||||
$(this)
|
||||
.text()
|
||||
.match(regex) !== null
|
||||
) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue