diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-04-27 04:01:34 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-04-27 10:35:31 +0200 |
commit | 18c11ec81b9fbfcad2567966036a26cb694a0c03 (patch) | |
tree | 97fe1885e6e17f5a6445c52f143b5c3d4f432b7e /apps | |
parent | 1384fdfe0137756a8a11db51f5ef7cf96aab2c97 (diff) | |
download | nextcloud-server-18c11ec81b9fbfcad2567966036a26cb694a0c03.tar.gz nextcloud-server-18c11ec81b9fbfcad2567966036a26cb694a0c03.zip |
jquery.combobox: Added 'editable' option and cleaned up a bit.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/contacts/js/jquery.combobox.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/contacts/js/jquery.combobox.js b/apps/contacts/js/jquery.combobox.js index f46d7c14c18..25f0f094296 100644 --- a/apps/contacts/js/jquery.combobox.js +++ b/apps/contacts/js/jquery.combobox.js @@ -53,13 +53,13 @@ return false; } }); - /*if ( !valid ) { + if ( !self.options['editable'] && !valid ) { // remove invalid value, as it didn't match anything $( this ).val( "" ); select.val( "" ); input.data( "autocomplete" ).term = ""; return false; - }*/ + } } } }) @@ -93,13 +93,14 @@ input.autocomplete( "search", "" ); input.focus(); });*/ + this.options['editable'] = true; $.each(this.options, function(key, value) { self._setOption(key, value); }); }, destroy: function() { this.input.remove(); - this.button.remove(); + //this.button.remove(); this.element.show(); $.Widget.prototype.destroy.call( this ); }, @@ -113,26 +114,29 @@ }, _setOption: function( key, value ) { switch( key ) { - case "id": + case 'id': this.options['id'] = value; this.input.attr('id', value); break; - case "name": + case 'name': this.options['name'] = value; this.input.attr('name', value); break; - case "attributes": + case 'attributes': var input = this.input; $.each(this.options['attributes'], function(key, value) { input.attr(key, value); }); break; - case "classes": + case 'classes': var input = this.input; $.each(this.options['classes'], function(key, value) { input.addClass(value); }); break; + case 'editable': + this.options['editable'] = value; + break; } // In jQuery UI 1.8, you have to manually invoke the _setOption method from the base widget $.Widget.prototype._setOption.apply( this, arguments ); @@ -141,7 +145,8 @@ }, options: { id: null, - name: null + name: null, + editable: true }, }); })( jQuery ); |