[英]Successfully refreshing ViewComponent with AJAX, but FullCalendar is not rendering with new ViewComponent
我已经在我的 ASP.NET Core Web 应用程序中将 FullCalendar 实现为视图组件。 此日历包含未安排约会的开放时间段。
现在我希望能够按持续时间过滤时隙; 例如,默认时隙设置为 15 分钟间隔,但用户可以将其更改为 30、45、60 等。每当用户更改此持续时间时,都会在 JS 中调用一个函数,在其中我发出 AJAX 请求:
$('#AppointmentDuration').on('change', function(){
$.ajax({
type: "GET",
url: "Sample/RefreshViewComponent",
data: {
"ProviderId": $('#ProviderFilter').val(),
"AppointmentDuration": $('#AppointmentDuration').val()
},
success: function (data) {
console.log(data);
$('#ViewComponent').html(data);
}
});
});
在此之后,我可以成功地在控制台中查看新的 ViewComponent(它本质上是完全相同的 html,但基于所选持续时间的日历具有不同的时隙/时刻/事件)。 在用新的 ViewComponent 替换 #ViewComponent 的 html 后,该页面也会重新呈现,但我的 FullCalendar 不再出现。
有谁知道这是为什么? 我已经尝试了所有这些操作:
$('#calendar').fullCalendar('destroy');
$('#calendar').fullCalendar('removeElements');
$('#calendar').fullCalendar('addEventSource', eventsObj);
$('#calendar').fullCalendar('refetchEvents');
任何意见,将不胜感激! 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.