When calendar list view is switched to custom date range, set range to current state

This commit is contained in:
Nathan Gray 2016-04-25 15:56:23 +00:00
parent 220aacf48b
commit 5740c448ad

View File

@ -1234,8 +1234,15 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
if (filter && dates)
{
dates.set_disabled(filter.value !== "custom");
if (filter.value == "custom")
if (filter.value == "custom" && !this.state_update_in_progress)
{
// Copy state dates over, without causing [another] state update
var actual = this.state_update_in_progress;
this.state_update_in_progress = true;
view.getWidgetById('startdate').set_value(app.calendar.state.first);
view.getWidgetById('enddate').set_value(app.calendar.state.last);
this.state_update_in_progress = actual;
jQuery(view.getWidgetById('startdate').getDOMNode()).find('input').focus();
}
}