fix a bug where edited places would not be updated correctly
This commit is contained in:
parent
9fb30bf1af
commit
db25eec98b
2 changed files with 13 additions and 8 deletions
|
@ -474,13 +474,17 @@ Ox.ListCalendar = function(options, self) {
|
|||
event.end = Ox.formatDate(endTime, '%Y-%m-%d %H:%M:%S', true);
|
||||
Ox.print(event);
|
||||
self.options.addEvent(event, function(result) {
|
||||
event.id = result.data.id;
|
||||
self.options.events.push(event);
|
||||
var time0 = +new Date()
|
||||
self.$list.options({items: Ox.clone(self.options.events, true)});
|
||||
Ox.print('TIME TO SET LIST OPTIONS:', +new Date() - time0);
|
||||
self.$calendar.addEvent(event);
|
||||
selectEvent(event);
|
||||
if (result.status.code == '200') {
|
||||
event.id = result.data.id;
|
||||
self.options.events.push(event);
|
||||
var time0 = +new Date()
|
||||
self.$list.options({items: Ox.clone(self.options.events, true)});
|
||||
Ox.print('TIME TO SET LIST OPTIONS:', +new Date() - time0);
|
||||
self.$calendar.addEvent(event);
|
||||
selectEvent(event);
|
||||
} else {
|
||||
alert(result.status.code)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -488,9 +492,9 @@ Ox.ListCalendar = function(options, self) {
|
|||
var id = self.selectedEvent,
|
||||
index = Ox.getPositionById(self.options.events, id),
|
||||
data = {id: id};
|
||||
data[key] = value;
|
||||
self.options.editEvent(data, function(result) {
|
||||
self.options.events[index][key] = value;
|
||||
data[key] = value;
|
||||
self.$list.value(id, key, value);
|
||||
if (['name', 'type', 'start', 'end'].indexOf(key) > -1) {
|
||||
self.$calendar.editEvent(id, key, value);
|
||||
|
|
|
@ -1178,6 +1178,7 @@ Ox.List = function(options, self) {
|
|||
// fixme: no case where callback is set
|
||||
// note: can't use selectNone here,
|
||||
// since it'd trigger a select event
|
||||
Ox.print('SET SELECTED', ids)
|
||||
var counter = 0;
|
||||
self.$items.forEach(function($item, pos) {
|
||||
if (isSelected(pos)) {
|
||||
|
|
Loading…
Reference in a new issue