allow 3rd-party JQ.UI autocomplete inputs
authorAlexey Andriyanov <alan@al-an.info>
Thu, 26 Jun 2014 14:09:00 +0000 (18:09 +0400)
committerAlexey Andriyanov <alan@al-an.info>
Thu, 26 Jun 2014 14:11:20 +0000 (18:11 +0400)
tag-it-local.js used to override the
.ui.autocomplete.prototype._resizeMenu handler for all autocomplete
menus.

Make it doing this only for tagit's inputs.

wwwroot/js/tag-it-local.js

index ffccde9..18045a8 100644 (file)
@@ -217,9 +217,13 @@ function generateTagList(input, ul, taglist, preselect, value_name, tag_limit, e
        var oldresizeMenu = $.ui.autocomplete.prototype._resizeMenu;
        $.ui.autocomplete.prototype._resizeMenu = function() {
                //oldresizeMenu.call(this);
-               var ul = this.menu.element;
-               ul.children("li:(.ui-menu-item)").addClass("tagit-menu-item");
-               ul.removeClass("ui-widget-content");
+               // do not interfere with other user-defined autocomplete inputs
+               if ($(this.element).filter('input[data-tagit=yes]').length)
+               {
+                       var ul = this.menu.element;
+                       ul.children("li:(.ui-menu-item)").addClass("tagit-menu-item");
+                       ul.removeClass("ui-widget-content");
+               }
        };
 
        function renderItem (ul, item) {