[FIX] web_calendar: reset dataset index if search result empty

This commit is contained in:
Denis Ledoux 2014-09-24 13:07:26 +02:00
parent 4a064b9374
commit 5c2fb121ca
1 changed files with 7 additions and 0 deletions

View File

@ -393,6 +393,13 @@ instance.web_calendar.CalendarView = instance.web.View.extend({
}).done(function(events) {
self.dataset_events = events;
self.events_loaded(events);
if (self.dataset.index === null) {
if (events.length) {
self.dataset.index = 0;
}
} else if (self.dataset.index >= events.length) {
self.dataset.index = events.length ? 0 : null;
}
});
});
},