I am working with full calendar but I have a problem, my calendar has data since 2016, and it is required to change several of the events, implement the edit event, all good, but the problem is that when I save a data and I'm in 2016, the page is refreshed and redirects me back to 2017 (current day) and I want to avoid that. I tried creating a button and placing the function
$ ('# calendar'). fullCalendar ('refetchEvents');
But because when I give save Changes in the following modal window, it is updated, I can not corroborate if the button actually serves, but apparently it does, because in the console it marks me that it returns to obtain the data of the events.
Because of the python flask function that I am using, it sends me a render_template that updates the page again, and is part of what I want to correct.
Python function:
@app.route('/calendar', methods=['GET','POST'])
def calendar():
#####################
"Lógica"
####################
sql="Consulta"
stmt = ibm_db.exec_immediate(conn,sql)
return render_template('calendar.html'); ##Aqui renderiza nuevamente la página
and here he left the fullcalendar code that I am using:
$(document).ready(function () {
$('#calendar').fullCalendar({
customButtons: {
refreshBtn: {
themeIcon: "refresh",
text: "Refresh",
click: function () {
$('#calendar').fullCalendar('refetchEvents');
}
}
},
header: {
left: 'prevYear,nextYear,today, refreshBtn',
center: 'title,prev,next',
right: 'month,agendaWeek,agendaDay,listWeek'
},
navLinks: true, // can click day/week names to navigate views
selectable: true,
selectHelper: true,
weekNumbers: true,
defaultView: 'month',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: {
url: 'datacalendar',
error: function () {
console.log("error")
}
},
eventClick: function (event, jsEvent, view) {
//alert("nombre del evento" + event.start.format("YYYY-MM-DD HH:MM:SS") );
//$('#myModalLabel').html(event.title);
$('#ModalTitle').html(event.title);
$('#start').val(event.start.format("YYYY-DD-MM hh:mm:ss"));
$('#end').val(event.end.format("YYYY-DD-MM hh:mm:ss"));
$('#category').val(event.title);
$('#Modalevent').modal('show');
},
select: function (start, end) {
$('#ModalAdd #start').val(moment(start).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd #end').val(moment(end).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd').modal('show');
},
});
});
Could someone help me solve this? Thank you very much.