
One of our most requested features is the ability to start the Resource and Horizon calendar views on a Monday: to keep these views toggled to the Monday of the current week when you return to the calendar on a particular day. In this blog post, we revisit this popular custom app action and introduce new features that let you expand this functionality to start your view on a particular day of the month or quarter.
Check it out:
Getting Started with Custom App Actions
If you’re new to customizing DayBack using app actions, check out this link on custom app actions for a library of custom actions and installation instructions. This action uses one of DayBack’s URL parameters to jump to the specific day of the week using URL transformations. To find out other cool stuff you can do with the DayBack URLs, check out this link on Manipulating DayBack with URL Parameters.
DayBack’s Global Settings for All Views
You may want to look at two DayBack settings that can remove weekends or change the start day of the week on the Weekly view, before installing this custom app action:
- Weekly views can already be configured to start on a different day of the Week by going to Administrative Settings > Date/Time Formats > First Day of the Week. By default, this is set to Sunday and can be changed to any day of the Week.
- If you simply don’t want to show Saturdays and Sundays on any of your views, you can toggle this setting in Administrative Settings > Views > Show Weekends.
Download and Configure the Action for Each View
Get started by downloading the action here: SetFocusDateOnViewChange.js
You can customize the behavior of most Resource Views and Horizon Views in the configuration section of this custom app action. Here are the available settings:
Available Views:
View Name | Setting Name |
Resource “Daily” view with Snap To Month Disabled | basicResourceDays |
Resource “List” view with days across the top | agendaResourceVert |
Resource “Schedule” view with days down the left-hand side | basicResourceVert |
Resource “Pivot List” view with days across the top | basicResourceHor |
Horizon View (Gantt Chart) – All types, including Breakdown By views | basicHorizon |
View Specific Configuration Options:
Setting Name | Possible Value | Usage Guidelines |
timeInterval | day month quarter | Specifies if the focus date should be in relation to the view’s current day, month, or quarter. This field is required, the others are required only in the context of the timeInterval setting. |
startOnDayOfWeek | 0-6 | Defines which day of the Current Week a view should start on. Set to 0 for Sunday, 1 for Monday. |
startOnDayOfMonth | 1-31 | A Month focus date will start on the 1st of the month. You may specifying a number from 1-31 to start on a different day. |
startOnDayOfQuarter | 1-93 | A Quarter focus date will start on the 1st day of the quarter. You may specify a number from 1-93 to start on a different day. |
You can also combine settings in various ways. For example, if you want to start a month view on the first Monday of the month you can set it as follows:
- timeInterval: ‘month’
- startOnDayOfMonth: 1
- startOnDayOfWeek: 1
Configuration Example
Here is an example of the configuration for each view type which you will need to edit, copy and paste into the relevant section of the custom app action:
inputs.views = { basicResourceDays: { timeInterval: 'day', startOnDayOfWeek: 1 }, agendaResourceVert: { timeInterval: 'day', startOnDayOfWeek: 1 }, basicResourceVert: { timeInterval: 'day', startOnDayOfWeek: 1 }, basicResourceHor: { timeInterval: 'month', startOnDayOfMonth: 1 }, basicHorizon: { timeInterval: 'quarter', startOnDayOfQuarter: 1, } };
Ensure to configure this action to run After Events Rendered, with Prevent Default Action set to Yes.
You can copy and paste your configuration into the full SetFocusDateOnViewChange.js code you downloaded above.
Conclusion
Adding custom app actions can be an easy way to quickly customize the user experience for each individual. If you’ve found this app action useful or would like to customize it for your workflow, please get in touch. We’d love to hear from you.
Leave a Reply