0
Imagine the following situation: I have 2 arrays and 2 views in my fullCalendar.
In the "list" view I need to render the first array of events, that reflects the select in a view in the database. These events come blank, and when filled in a modal are registered and stop at another table, that in turn I make a select and store the result in another array, which will be rendered in the "Month view"
my code looks like this
//array de teste que vem de uma função do php
<?php
$dadosDaTabela = \App\Models\AgendasMedicas::GetAllofThisDataAgenda($doctorVal);
foreach ($dadosDaTabela as $value) {
?> {
//o conteudo aqui nao interessa, o importante pra mim é ver se alguma coisa é retornada
id: '<?php echo $value['DT_CONSULTA_AGENDADA']; ?>',
title: '<?php echo $value['DT_CONSULTA_AGENDADA']; ?>',
color: 'red',
start: '<?php echo $value['DT_CONSULTA_AGENDADA']; ?>',
},
<?php }
?>
];
//no meu full calendar, tento isto:
$('#calendar').fullCalendar({
viewRender: function (view, element) {
if (view.name == 'list') {
//aqui meu array é renderizado, o problema é que ele se renderiza nas outras views também...
events: events_array
}
if (view.name == 'month') {
alert('month')
}
if (view.name == 'agendaWeek') {
alert('agendaWeek')
}
},
timezone: 'America/Sao_Paulo',
header: {
left: ' prev title next ',
right: 'list,agendaWeek,month'
},
buttonText: {
list: 'Hoje',
listWeek: 'Semana'
}
});
Checks whether the attribute
id
of the elements is not the same, maybe posting the HTML can help solve the problem.– Leonardo Barros
Fullcalendar is mounted only through a div with the id "Calendar"... there is no more than that in my HTML.
– Hiury B. Bressanelli
The id of the elements cannot be the same, Leonardo, because I assign them date and time, so it is impossible to be equal.
– Hiury B. Bressanelli
So you only have one calendar and want to change events according to the selected view?
– Leonardo Barros
Exactly, I have 2 javascript arrays that are fed with php foreachs, and I would like in one view my event array 1 to be loaded, and in another view, array 2 to be loaded
– Hiury B. Bressanelli