How would I update the "StartDate" value of the DayPilot Lite Calendar object? I'm trying to do so from Javascript using the value of a jQuery Datepicker object. Below are snippets of my implementation:
~~~~~~~~~~~~~
Controller:
~~~~~~~~~~~~~
public ActionResult Backend(int productId, int archiveId)
{
return new Dpc(productId, archiveId, target).CallBack(this);
}
class Dpc : DayPilotCalendar
{
public Dpc(int productId, int archiveId)
{
this.ProductId = productId;
this.ArchiveId = archiveId;
}
protected override void OnInit(InitArgs e)
{
// ...
// data fetching, which loads "List<T>" object, and passes the ".ToArray()" output into DayPilotCalendar's "Events" property
// ...
DataIdField = "ScheduleId";
DataTextField = "Summary";
DataStartField = "Start";
DataEndField = "End";
Update();
}
private int ArchiveId { get; set; }
private int ProductId { get; set; }
}
~~~~~~~~~~~~~
// end of snippet
~~~~~~~~~~~~~
~~~~~~~~~~~~~
View:
~~~~~~~~~~~~~
// ...
<p>Pick a date:
<br/>@Html.TextBox("txtDate", Model.LastScheduleStartDay.ToString("MM/dd/yyyy"), new { @class = "date", @maxlength = "10", @style = "width:100px;" })
<br/>@Html.TextBox("alternate", Model.LastScheduleStartDay.ToString("MM/dd/yyyy"), new { @class = "meh", @maxlength = "10", @style = "width:100px; visibility:hidden;" })</p>
<script type="text/javascript">
$(document).ready(function () {
$('.date').datepicker({
dateFormat: "mm/dd/yy",
altField: "#alternate",
altFormat: "DD, d MM, yy"
});
$('#txtDate').change(function () {
var newDateTime = new Date(Date.parse($("#alternate").val()));
dpc.startDate = newDateTime;
dpc.callBack2('Init');
});
});
</script>
@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig
{
ViewType = ViewType.Day,
WeekStarts = WeekStarts.Sunday,
BackendUrl = @resultUrl,
StartDate = @Model.LastScheduleStartDay,
CellHeight = 30,
HourWidth = 50,
Width = "98%",
ShowToolTip = true
})
~~~~~~~~~~~~~
// end of snippet
~~~~~~~~~~~~~
Any guidance is appreciated!