Question

Sorry for the mistakes, I'm French.

I use the Dojo calendar and there are some buttons "Today" "4 Days", "Week", "Month"... Is there a javascript function which do like if I clicked on one of these buttons, and thus changes the DateInterval property ? Or there is an other way to do that ?

Thank your for your help.

Was it helpful?

Solution

So if I understand correctly, you want to change the date interval without having to click one of these buttons? You can do that with the dateInterval property which accepts, according to the API documentation, the values: day, week and month (I have no clue how to get the "4 weeks").

This means you can change them by using:

registry.byId("myCalendar").set("dateInterval", "day");

I also made an example JSFiddle (doesn't render properly, but the button does what you want). You can of course change the initiator (I created a seperate button), but it can be anything.


EDIT: As requested in the comments, you can determine which "view" is chosen by using the following event handler:

registry.byId("test").set('onTimeIntervalChange', function(e) {
       console.log(e);
});

However, this event will always be executed when the time interval changes, so it will probably also be called when you click a custom button like in my previous example. I have no clue if there's an event handler more suitable to your situation, but the API documentation will probably be very helpful to you.

Anyways, I updated the JSFiddle which you can find here.

OTHER TIPS

To get the four day calendar set this

registry.byId("myCalendar").set("dateInterval", "day");

and then this

registry.byId("myCalendar").set("dateIntervalSteps", 4);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top