ArrayEditable: properly set placeholder

This commit is contained in:
rolux 2014-02-04 07:56:36 +00:00
parent 0940d7317b
commit 0d0999805c

View file

@ -57,9 +57,10 @@ Ox.ArrayEditable = function(options, self) {
}, },
placeholder: function() { placeholder: function() {
if (self.options.items.length == 0) { if (self.options.items.length == 0) {
self.$items[0] self.$items[0].options({
.options({value: self.options.placeholder}) placeholder: self.options.placeholder,
.addClass('OxPlaceholder'); value: ''
});
} }
}, },
selected: function() { selected: function() {
@ -140,10 +141,10 @@ Ox.ArrayEditable = function(options, self) {
if (self.options.items.length == 0) { if (self.options.items.length == 0) {
self.$items[0] = Ox.Editable({ self.$items[0] = Ox.Editable({
editable: false, editable: false,
placeholder: self.options.placeholder,
type: self.options.type, type: self.options.type,
value: self.options.placeholder value: ''
}) })
.addClass('OxPlaceholder')
.appendTo(that); .appendTo(that);
} else { } else {
sortItems(); sortItems();
@ -159,11 +160,6 @@ Ox.ArrayEditable = function(options, self) {
clickLink: self.options.clickLink, clickLink: self.options.clickLink,
editable: self.options.editable && item.editable, editable: self.options.editable && item.editable,
editing: self.editing && i == self.selected, editing: self.editing && i == self.selected,
/*
format: function(value) {
return value || ' '
},
*/
globalAttributes: self.options.globalAttributes, globalAttributes: self.options.globalAttributes,
highlight: self.options.highlight, highlight: self.options.highlight,
maxHeight: self.options.maxHeight, maxHeight: self.options.maxHeight,
@ -184,7 +180,6 @@ Ox.ArrayEditable = function(options, self) {
width: self.options.type == 'input' ? 0 : self.options.width - 9 width: self.options.type == 'input' ? 0 : self.options.width - 9
}) })
.addClass(item.id == self.options.selected ? 'OxSelected' : '') .addClass(item.id == self.options.selected ? 'OxSelected' : '')
//.css(self.options.type == 'textarea' ? {padding: '4px'} : {})
.data({id: item.id, position: i}) .data({id: item.id, position: i})
.bindEvent({ .bindEvent({
blur: function(data) { blur: function(data) {