autocomplete adding breakValue options

This commit is contained in:
2025-01-02 16:56:15 +07:00
parent 99415e5dc9
commit 1fa2b49c12
3 changed files with 14 additions and 20 deletions
+5 -4
View File
@@ -312,9 +312,10 @@ var AutoComplete = (function () {
select: null,
focus: null,
},
//gnips: adding callback and keydown function
//gnips: adding callback, keyfunc and breakvalue
selectFunc: function(){},
keydownFunc: function(){}
keyFunc: function(){},
breakValue: []
};
this._el = element;
this._$el = $(this._el);
@@ -352,8 +353,8 @@ var AutoComplete = (function () {
AutoComplete.prototype.bindDefaultEventListeners = function () {
var _this = this;
this._$el.on('keydown', function (evt) {
//gnips: call keydown function
('' == _this._$el.val() && _this._settings.keydownFunc(evt.which));
//gnips: check breakValue and call keydown function
(('' == _this._$el.val() || ((_this._settings.breakValue.length > 0) && (_this._settings.breakValue.indexOf(_this._$el.val()) != -1))) && _this._settings.keyFunc(evt.which, _this._$el.val()));
switch (evt.which) {
case 9:
if (_this._dd.isItemFocused) {