mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-18 07:52:21 +01:00
Contacts: combox's underlying select wasn't updated on change.
This commit is contained in:
parent
b92ec990e5
commit
4ce6420156
@ -48,17 +48,29 @@
|
||||
self._trigger('selected', event, {
|
||||
item: ui.item.option
|
||||
});
|
||||
select.children('option').each(function() {
|
||||
if ($(this).text().toLowerCase() === $(ui.item.option).text().toLowerCase()) {
|
||||
$(this).attr('selected', 'selected');
|
||||
} else {
|
||||
$(this).removeAttr('selected');
|
||||
}
|
||||
});
|
||||
select.trigger('change');
|
||||
},
|
||||
change: function( event, ui ) {
|
||||
if ( !ui.item ) {
|
||||
var matcher = new RegExp( '^' + $.ui.autocomplete.escapeRegex( $(this).val() ) + '$', 'i' ),
|
||||
if(!ui.item) {
|
||||
var matcher = new RegExp( '^' + $.ui.autocomplete.escapeRegex($(this).val()) + '$', 'i'),
|
||||
valid = false;
|
||||
self.input.val($(this).val());
|
||||
//self.input.trigger('change');
|
||||
select.children('option').each(function() {
|
||||
if ( $( this ).text().match( matcher ) ) {
|
||||
if ($(this).text().match(matcher)) {
|
||||
this.selected = valid = true;
|
||||
return false;
|
||||
$(this).attr('selected', 'selected');
|
||||
select.trigger('change');
|
||||
//return false;
|
||||
} else {
|
||||
$(this).removeAttr('selected');
|
||||
}
|
||||
});
|
||||
if ( !self.options['editable'] && !valid ) {
|
||||
@ -67,6 +79,9 @@
|
||||
select.val( "" );
|
||||
input.data('autocomplete').term = '';
|
||||
return false;
|
||||
} else if(!valid) {
|
||||
select.append('<option selected="selected">' + $(this).val() + '</option>');
|
||||
select.trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user