update item by id not position
This commit is contained in:
parent
c2d35e615d
commit
009cdd68c3
3 changed files with 23 additions and 12 deletions
|
|
@ -71,8 +71,10 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
}
|
||||
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
||||
var item = Ox.getObjectById(self.options.items, self.options.selected);
|
||||
item[key] = value;
|
||||
item.duration = self.options.out - self.options['in'];
|
||||
if (item) {
|
||||
item[key] = value;
|
||||
item.duration = self.options.out - self.options['in'];
|
||||
}
|
||||
self.points = getPoints();
|
||||
}
|
||||
if (key == 'in') {
|
||||
|
|
@ -620,10 +622,12 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
|
||||
function submitAnnotation(data) {
|
||||
var item = Ox.getObjectById(self.options.items, data.id);
|
||||
item.value = data.value;
|
||||
self.editing = false;
|
||||
self.options.sort == 'text' && self.$annotations.reloadItems();
|
||||
that.triggerEvent('submit', item);
|
||||
if (item) {
|
||||
item.value = data.value;
|
||||
self.editing = false;
|
||||
self.options.sort == 'text' && self.$annotations.reloadItems();
|
||||
that.triggerEvent('submit', item);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleLayer() {
|
||||
|
|
@ -749,6 +753,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
(id, data) -> <o> update item
|
||||
@*/
|
||||
that.updateItem = function(id, data) {
|
||||
Ox.Log('AF', 'updateItem', id, data)
|
||||
var item = Ox.getObjectById(self.options.items, id);
|
||||
Ox.forEach(data, function(value, key) {
|
||||
item[key] = value;
|
||||
|
|
@ -760,7 +765,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
if (id != item.id) {
|
||||
self.$annotations.find('.OxEditableElement').each(function() {
|
||||
var $element = $(this);
|
||||
if ($element.data('id') == self.options.selected) {
|
||||
if ($element.data('id') == id) {
|
||||
$element.data({id: item.id});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue