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

Scheduler navigation with JQuery Datepicker.

Asked by Vatthanachai W.
3 years ago.

Hi,
I have some issue with navigation with JQuery Datepicker. I have already test on local computer it's OK (has 7 days). But when I publish the project to azure the scheduler has 8 day. Not sure this issue is from azure or code.
Can you guide or help me to fix it?
Thanks

backend
[code]
protected override void OnCommand(CommandArgs e)
{
switch (e.Command)
{
case "previous":
StartDate = StartDate.AddDays(-7);
break;
case "today":
StartDate = FirstDayOfWeekUtility.GetFirstDayOfWeek(DateTime.Today);
break;
case "next":
StartDate = StartDate.AddDays(7);
break;
case "refresh":
break;
case "navigate":
StartDate = (DateTime) e.Data["start"];
break;
}
Update(CallBackUpdateType.Full);
}
[/code]

frontend
[code]
<div class="row">
@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig
{
BackendUrl = Url.Action("SchedulesBackEnd", "Home"),
CssOnly = true,
CssClassPrefix = "z",
Scale = TimeScale.Day,
StartDate = FirstDayOfWeekUtility.GetFirstDayOfWeek(DateTime.Today),
Days = 7,
WeekStarts = WeekStarts.Sunday,
Width = "100%",
TimeHeaders = new TimeHeaderCollection()
{
new TimeHeader(GroupBy.Month),
new TimeHeader(GroupBy.Day)
},
CellWidth = 107,
RowMinHeight = 10,
EventMovingStartEndEnabled = true,
MoveBy = DragArea.Full,
TreeEnabled = true,
TreePreventParentUsage = false,
EventMoveHandling = EventMoveHandlingType.CallBack,
EventResizeHandling = EventResizeHandlingType.CallBack,
EventDeleteHandling = EventDeleteHandlingType.CallBack,
EventMovingJavaScript = "onEventMoving(args)",
AutoRefreshEnabled = true,
AutoRefreshInterval = 60,
AfterRenderJavaScript = "loadData()",
EventSelectJavaScript = "onEventSelect(args)",
})

</div>

<script>
$('#dpn')
.datepicker({
showOtherMonths: true,
selectOtherMonths: true,
onSelect: function (txt, inst) {
// "data":{"start":"weekStart","end":"weekEnd","days":7,"day":"SelectDate"}

var date = $(this).datepicker('getDate');
var startWeek = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay());
var endWeek = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay() + 6);

var dateFormat = inst.settings.dateFormat || $.datepicker._defaults.dateFormat;

console.log("start : " + startWeek + ", end : " + endWeek + ", today : " + date);

dps.commandCallBack('navigate',
{
start: startWeek,
end: endWeek,
days: 7,
day: date
});
}
});

</script>
[/code]

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