update ArrayInput

This commit is contained in:
rolux 2011-06-01 15:12:14 +02:00
parent 944d4036b0
commit 4f77725a74

View file

@ -56,8 +56,7 @@ Ox.ArrayInput = function(options, self) {
.appendTo(self.$element[i])); .appendTo(self.$element[i]));
focus && self.$input[i].focusInput(); focus && self.$input[i].focusInput();
self.$removeButton.splice(i, 0, Ox.Button({ self.$removeButton.splice(i, 0, Ox.Button({
disabled: self.$input.length == 1, title: self.$input.length == 1 ? 'close' : 'remove',
title: 'remove',
type: 'image' type: 'image'
}) })
.css({float: 'left', marginLeft: '8px'}) .css({float: 'left', marginLeft: '8px'})
@ -68,7 +67,11 @@ Ox.ArrayInput = function(options, self) {
self.$input[index].options({value: ''}); self.$input[index].options({value: ''});
that.triggerEvent('change', {value: that.value()}); that.triggerEvent('change', {value: that.value()});
} }
removeInput(index); if (self.$input.length == 1) {
self.$input[0].focusInput();
} else {
removeInput(index);
}
} }
}) })
.appendTo(self.$element[i])); .appendTo(self.$element[i]));