Hi, I'm trying the MVC Daypilot component. I'm using the last version downloaded from the site.
I have added the component using HtmlHelper, and then I have changed the Scale to Week in the OnInit.
This is the Index.cshtml
@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig
{
BackendUrl = Url.Content("~/Graph/Backend"),
EventResizeHandling = EventResizeHandlingType.CallBack,
EventMoveHandling = EventMoveHandlingType.CallBack,
CellGroupBy = DayPilot.Web.Mvc.Enums.GroupBy.Month,
CellWidth = 19,
TreeEnabled = true,
TreeIndent = 15,
Days = 365,
StartDate = new DateTime(DateTime.Today.Year, 1, 1),
CssOnly = true,
EventHeight = 25
})
<a href="javascript:dps.commandCallBack('next');">Next</a>
<a href="javascript:dps.commandCallBack('previous');">Previous</a>
And this is the Controller:
protected override void OnInit(InitArgs e)
{
Scale = TimeScale.Week;
LoadResources();
UpdateWithMessage("Welcome!", CallBackUpdateType.Full);
}
protected override void OnCommand(CommandArgs e)
{
switch (e.Command)
{
case "refresh":
UpdateWithMessage("Refreshed");
break;
case "next":
StartDate = StartDate.AddYears(1);
Days = Year.Days(StartDate);
Update(CallBackUpdateType.Full);
break;
case "previous":
StartDate = StartDate.AddYears(-1);
Days = Year.Days(StartDate);
Update(CallBackUpdateType.Full);
break;
}
}
The problem is that every time I press Next or Previous the Scale is reset to Day. I have made some tests and if I put the Scale in the Helper directly to Week, then it is always reset to Week. It seems that for some reason the MVC controller is not able to maintain the Scale value. No problem with the WebForm component.
Is it a bug ?
Andrea