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]));
focus && self.$input[i].focusInput();
self.$removeButton.splice(i, 0, Ox.Button({
disabled: self.$input.length == 1,
title: 'remove',
title: self.$input.length == 1 ? 'close' : 'remove',
type: 'image'
})
.css({float: 'left', marginLeft: '8px'})
@ -68,7 +67,11 @@ Ox.ArrayInput = function(options, self) {
self.$input[index].options({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]));