not failing if filter or dates widgets are not there

This commit is contained in:
Ralf Becker 2013-08-22 07:30:01 +00:00
parent b2ba685edd
commit 10f8c8e1ae

View File

@ -56,13 +56,12 @@ app.timesheet = AppJS.extend(
et2_ready: function(et2) et2_ready: function(et2)
{ {
// call parent // call parent
this._super.apply(this, arguments); this._super.apply(this, arguments);
if (typeof et2.templates['timesheet.index'] != "undefined") if (typeof et2.templates['timesheet.index'] != "undefined")
{ {
this.timesheet_filter_change(); this.timesheet_filter_change();
} }
}, },
/** /**
@ -70,14 +69,12 @@ app.timesheet = AppJS.extend(
*/ */
timesheet_filter_change: function() timesheet_filter_change: function()
{ {
if (etemplate2.getByApplication('timesheet')[0].widgetContainer.getWidgetById('filter').value === "custom") var filter = this.et2.getWidgetById('filter');
var dates = this.et2.getWidgetById('timesheet.index.dates');
if (filter && dates)
{ {
etemplate2.getByApplication('timesheet')[0].widgetContainer.getWidgetById('timesheet.index.dates').set_disabled(false); dates.set_disabled(filter.value !== "custom");
}
else
{
etemplate2.getByApplication('timesheet')[0].widgetContainer.getWidgetById('timesheet.index.dates').set_disabled(true);
} }
}, },
}); });