")
.addClass("input-group filtering-select")
.attr("data-input-for", inputFor);
},
_initAutocomplete: function () {
var self = this;
return this.input.autocomplete({
delay: this.options.searchDelay,
minLength: this.options.minLength,
source: this._getSourceFunction(this.options.source),
select: function (event, ui) {
var option = $("
')
);
self.input.data("ui-autocomplete").term = "";
$(self.element.parents(".controls")[0])
.find(".update")
.addClass("disabled");
return false;
},
});
},
_initKeyEvent: function () {
var self = this;
return this.input.keyup(function () {
if ($(this).val().length) {
return;
}
/* Clear select options and trigger change if selected item is deleted */
return self.element
.html($('
'))
.trigger("change");
});
},
_overloadRenderItem: function () {
this.input.data("ui-autocomplete")._renderItem = function (ul, item) {
return $("
")
.data("ui-autocomplete-item", item)
.append($("
").html(item.html || item.id))
.appendTo(ul);
};
},
destroy: function () {
this.input.remove();
this.button.remove();
this.element.show();
this.filtering_select.remove();
$.Widget.prototype.destroy.call(this);
},
});
})(jQuery);