fix bugs in list calendar, related to selecting an event on the calendar, just after load, which is not yet in the scope of the list
This commit is contained in:
parent
244312aede
commit
14102508e1
2 changed files with 21 additions and 14 deletions
|
@ -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,22 +732,28 @@ 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();
|
||||
|
@ -755,7 +761,7 @@ Ox.ListCalendar = function(options, self) {
|
|||
self.$eventForm.values(
|
||||
decodeValues(Ox.extend({}, event, {
|
||||
end: event.current ? '' : event.end,
|
||||
duration: Ox.formatDateRangeDuration(
|
||||
durationText: Ox.formatDateRangeDuration(
|
||||
event.start, event.end, true
|
||||
)
|
||||
}))
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue