diff --git a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js index 6f2dd974..5942b266 100644 --- a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js +++ b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js @@ -365,7 +365,7 @@ Ox.ListCalendar = function(options, self) { }), self.$durationInput = Ox.Input({ disabled: true, - id: 'duration', + id: 'durationText', label: 'Duration', labelWidth: 64, width: 240 @@ -724,7 +724,7 @@ Ox.ListCalendar = function(options, self) { var isUndefined = !!self.options.selected && !self.$list.value(self.options.selected, 'type'); self.selectedEvent = event.id || ''; - if (!self.selectedPlace && isUndefined) { + if (!self.selectedEvent && isUndefined) { // deselect triggered by selecting an undefined item, // so do nothing } else { @@ -732,30 +732,36 @@ Ox.ListCalendar = function(options, self) { self.$list.options({ selected: self.options.selected ? [self.options.selected] : [] }); - selectItem({ids: self.$list.options('selected')}); + selectItem({ids: self.$list.options('selected')}, event); } } - function selectItem(data) { + function selectItem(data, event) { // Select item in list - var event, isUndefined, selectedEvent; + var fromCalendar = !!event, isUndefined, selectedEvent; self.options.selected = data.ids.length ? data.ids[0] : ''; - event = self.options.selected - ? self.$list.value(self.options.selected) : {}; - isUndefined = !!self.options.selected + event = event || ( + self.options.selected + ? self.$list.value(self.options.selected) + : {} + ) + isUndefined = !fromCalendar && !!self.options.selected && !self.$list.value(self.options.selected, 'type'); - selectedEvent = self.options.selected && !isUndefined - ? self.options.selected : ''; - self.$calendar.options({selected: selectedEvent}); - selectedEvent && self.$calendar.panToEvent(); + if (!fromCalendar) { + selectedEvent = self.options.selected && !isUndefined + ? self.options.selected + : ''; + self.$calendar.options({selected: selectedEvent}); + selectedEvent && self.$calendar.panToEvent(); + } if (self.options.selected) { self.$eventName.options({title: event.name || ''}); - self.$eventTitle.show(); + self.$eventTitle.show(); if (!isUndefined) { self.$eventForm.values( decodeValues(Ox.extend({}, event, { end: event.current ? '' : event.end, - duration: Ox.formatDateRangeDuration( + durationText: Ox.formatDateRangeDuration( event.start, event.end, true ) })) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index d32e565a..ddb40608 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1673,6 +1673,7 @@ Ox.List = function(options, self) { var pos = Ox.isNumber(id) ? id : getPositionById(id), $item = self.$items[pos], data = $item ? $item.options('data') : {}; + //Ox.print('List', 'that.value id key value pos', id, key, value, pos) if (arguments.length == 1) { return data; } else if (arguments.length == 2) {