Fullcalendar minTime ajax -


i'm trying change mintime in fullcalendar according database schedule through ajax request on viewrender, goes loop.

part of calendaroptions:

var calendaroptions = {     header: {         left: ' today',         center: 'prev,title,next',         right: 'agendaweek,resourceday'     },     defaultview: 'resourceday', 

the viewrender:

viewrender: function(view, element){         var curdate = ($('#calendar').fullcalendar('getdate')).format('d-dd-mm').split('-');         var curweekday = curdate[0];         var curmonthday = curdate[1];         var curmonth = curdate[2];          $.ajax({             url: 'calendar/getbusinesshours',             type: 'get',             data: {                 'day': curweekday,                 "_token": $('body').find( 'input[name=_token]' ).val()             },             success: function (response) {                 $('#calendar').fullcalendar("destroy");                 $("#calendar").fullcalendar(                     $.extend(calendaroptions, {                         defaultdate: currentdate,                         mintime: response[0].open_time+':00',                         maxtime: response[0].close_time+':00'                     })                 );             }         });     }, 

the ajax response '08:00:00' there no problem there;

i have not tested believe problem comes destroying fullcalendar , setting again. essentially, happens calendar loads , view rendered, make ajax request, destroy calendar, create new 1 triggers viewrender again , on.

success: function (response) {             $('#calendar').fullcalendar("destroy");             $("#calendar").fullcalendar(... 

you can either load mintime , maxtime before initializing calendar (getting values database ajax call , initializing calendar when values retrieved back-end can pass them initialization options) or change values inside different event (not viewrender)

what can add variable equation , launch ajax conditionally - if calendar not in process of reconstructing new mintime , maxtime.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -