update item by id not position
This commit is contained in:
parent
c2d35e615d
commit
009cdd68c3
3 changed files with 23 additions and 12 deletions
|
|
@ -220,10 +220,11 @@ Ox.ArrayEditable = function(options, self) {
|
|||
}, 250);
|
||||
},
|
||||
cancel: function(data) {
|
||||
var id = $(this).data('id');
|
||||
self.editing = false;
|
||||
that.gainFocus();
|
||||
data.value === ''
|
||||
? submitItem(i, '')
|
||||
? submitItem(id, '')
|
||||
: that.triggerEvent('blur', data);
|
||||
},
|
||||
change: function(data) {
|
||||
|
|
@ -247,9 +248,10 @@ Ox.ArrayEditable = function(options, self) {
|
|||
that.triggerEvent('open');
|
||||
},
|
||||
submit: function(data) {
|
||||
var id = $(this).data('id');
|
||||
self.editing = false;
|
||||
that.gainFocus();
|
||||
submitItem(i, data.value);
|
||||
submitItem(id, data.value);
|
||||
}
|
||||
})
|
||||
.appendTo(that);
|
||||
|
|
@ -364,8 +366,9 @@ Ox.ArrayEditable = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
function submitItem(position, value) {
|
||||
var item = self.options.items[position];
|
||||
function submitItem(id, value) {
|
||||
var item = Ox.getObjectById(self.options.items, id);
|
||||
Ox.Log('AE', 'submitItem', id, item)
|
||||
if (value === '') {
|
||||
deleteItem(item.id);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue