I'm trying to pass function from MVC model to fullcalendar CustomButton like so
var model = new CalendarViewModel()
{
(...different properties of fullcalendar...)
CustomButtons = new
{
CustomButton = new
{
Text = "Custom",
Click = "function() { window.location.href = " + Url.Action("CustomView", "Custom") + "; }"
}
},
Header = new { Center = "title", Left = "prev,next customButton", Right = "month,agendaWeek,agendaDay,today" },
};
And then serialize and pass it to js file
function initFrom(calendarViewModel, rootUrl) {
$('#calendar').fullCalendar(calendarViewModel);
}
However I get error customButtonProps.click.call is not a function
which I belive is caused because I'm passing string from serialized model.
If my approach is incorrect how can I achieve desired result - passing routing values to custom button click function (without hardcoding route values inside js file)?