]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Added position option. Fixes #5153 - Autocomplete position option.
authorScott González <scott.gonzalez@gmail.com>
Mon, 19 Jul 2010 13:28:04 +0000 (09:28 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 19 Jul 2010 13:28:04 +0000 (09:28 -0400)
tests/unit/autocomplete/autocomplete_defaults.js
ui/jquery.ui.autocomplete.js

index c6017d62ca68cb88d5eb02849ff2af50ad1abb71..8dad15e8f5e8ace188c96de39e0f5a74493a3df0 100644 (file)
@@ -6,7 +6,12 @@ var autocomplete_defaults = {
        delay: 300,
        disabled: false,
        minLength: 1,
-       source: undefined
+       position: {
+               my: "left top",
+               at: "left bottom",
+               collision: "none"
+       },
+       source: null
 };
 
 commonWidgetTests('autocomplete', { defaults: autocomplete_defaults });
index 3fa196ecb6af42328e6b4ae224767b5a99da9693..1391643ba5fb91dc4d62f1de33039d6b14392734 100644 (file)
 
 $.widget( "ui.autocomplete", {
        options: {
+               delay: 300,
                minLength: 1,
-               delay: 300
+               position: {
+                       my: "left top",
+                       at: "left bottom",
+                       collision: "none"
+               },
+               source: null
        },
        _create: function() {
                var self = this,
@@ -269,12 +275,9 @@ $.widget( "ui.autocomplete", {
                // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
                this.menu.deactivate();
                this.menu.refresh();
-               this.menu.element.show().position({
-                       my: "left top",
-                       at: "left bottom",
-                       of: this.element,
-                       collision: "none"
-               });
+               this.menu.element.show().position( $.extend({
+                       of: this.element
+               }, this.options.position ));
 
                menuWidth = ul.width( "" ).outerWidth();
                textWidth = this.element.outerWidth();