Open trivektor opened 13 years ago
I quick-fixed this plugin to work with jquery-1.6.1 and jquery-ui-1.8.16
Here's the patch:
Index: web-app/js/jquery.combobox/ui.combobox.js
===================================================================
--- web-app/js/jquery.combobox/ui.combobox.js (revision 75cd6c06f3813fc4154e5e6d8bab0303ee006f99)
+++ web-app/js/jquery.combobox/ui.combobox.js (revision )
@@ -16,7 +16,7 @@
* @author Jonathan Tang
* @dependency jquery-1.2.6.js
* @dependency ui.core.js
- * @version 1.0.1
+ * @version 1.0.6_fixed_to_work_against_jquery.ui.1.8.16
*
* vim: noexpandtab
*/
@@ -29,6 +29,23 @@
KEY_F4 = 115;
$.widget('ui.combobox', {
+ getter: 'getData',
+ version: '1.0.6_fixed_to_work_against_jquery.ui.1.8.16',
+ options: {
+ data: [],
+ autoShow: true,
+ matchMiddle: true,
+ change: function(e, ui) {},
+ select: function(e, ui) {},
+ key: function(e, ui) {},
+ arrowURL: 'drop_down.png',
+ arrowHTML: function() {
+ return $('<img class = "ui-combobox-arrow" border = "0" src = "'
+ + this.options.arrowURL + '" width = "18" height = "22" />')
+ },
+ listContainerTag: 'span',
+ listHTML: defaultListHTML
+ },
/**
* Main JQuery method. Call $(selector).combobox(options) on any element,
@@ -251,6 +268,9 @@
$('.ui-combobox-list').hide();
this.listElem.css(styles).show();
this.changeSelection(this.findSelection(), e);
+ if (this.listElem.children('.selected').length > 0) {
+ this.listElem.children('.selected')[0].scrollIntoView();
+ }
},
/**
@@ -351,26 +371,6 @@
});
-$.extend($.ui.combobox, {
- getter: 'getData',
- version: '1.0.6',
- defaults: {
- data: [],
- autoShow: true,
- matchMiddle: true,
- change: function(e, ui) {},
- select: function(e, ui) {},
- key: function(e, ui) {},
- arrowURL: 'drop_down.png',
- arrowHTML: function() {
- return $('<img class = "ui-combobox-arrow" border = "0" src = "'
- + this.options.arrowURL + '" width = "18" height = "22" />')
- },
- listContainerTag: 'span',
- listHTML: defaultListHTML
- }
-});
-
// Hack for chainability - since the combobox modifies this.element but 'this'
// is only the UI instance, it leaves the JQuery collection itself pointing
// at stale, removed-from-DOM instances. This hack invokes the UI-factory
Hi,
I ran into the issue with jQuery 1.6.1 and Coffee Script
$("#parking_zone_number1").combobox({ data: ["Orange", "Banana", "Apple", "Strawberry"], }).bind 'comboboxselect', (e, ui) -> console.log(ui.value)
Basically, ui.value is always undefined. Did you test this with jquery latest recently? Thanks.