search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

how can i get the calendar to show an specific date?

Asked by francisco manuel somoza triƱanes
4 years ago.

Hi, im trying the JavaScript Daypilot with a spring mvc model.

how i put in to the dp.startDate a date retrieved from the controller?

The idea is i want to start the calendar in an specific month to show an specific event.
Do i need to use an AJAX call to do it?

var nav = new DayPilot.Navigator("nav");
nav.showMonths = 3;
nav.skipMonths = 3;
nav.selectMode = "month";
nav.onTimeRangeSelected = function(args) {
dp.startDate = args.day;
dp.update();
dp.events.load("/solicitudPendiente");
};
nav.init();

var dp = new DayPilot.Month("dp");
dp.init();
dp.eventEndSpec = "Date";

Answer posted by francisco manuel somoza triƱanes
4 years ago.

i solved this in an easier way than i expected. I just discovered i can use thymeleaf in the javascript so i send the model of an event to the view and i get it done like this.

<script th:inline="javascript">

var dp = new DayPilot.Month("dp");
dp.startDate = [[${event.start}]];
dp.update();
dp.init();

hope this can help anybody with the same problem

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.