I'm working with an event calendar and would like the calendar to show me in different color the days that have events.
I use the datepicker . link
I'm looking through the documentation, but I'm not finding something like that that can help me. I'll have to search the bank via Ajax to pick up the days that have an event.
I'll have to use this in some option
or method
of the calendar to compare days and set the date that has event, a highlight
, for example.
My code so far is the one that works, I just need to implement what I'm talking about.
JS
$('#ui-calendar').datepicker({
closeText: 'Fechar',
prevText: 'Anterior',
nextText: 'Próximo',
currentText: 'Hoje',
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', 'Jul','Ago','Set','Out','Nov','Dez'],
dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
weekHeader: 'Sm',
dateFormat: 'dd/mm/yy',
todayHighlight: false,
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: '',
onSelect: function(dateText){
var box = $('#treinamentos');
var loa = $('.load');
var err = $('.error');
$.ajax({
type: "POST",
dataType: "json",
cache: false,
url: urlBase + '/select-treinamentos',
data: { dataSelect : dateText},
beforeSend: function(){
box.html('');
err.hide();
loa.show();
},
success: function(data){
loa.hide();
if(data.length == 0)
err.show();
else{
box.html('');
$.each(data, function(index, value){
box.append('<tr><td><span class="titulo">'+ value.titulo +'</span><span class="subtitulo">'+ value.subtitulo
'</span><a href="'+urlBase+'/informacoes/'+value.id+'">MAIS INFORMAÇÕES</a></td></tr>');
});
}
}
})
}
});
HTML
<div class="" id="ui-calendar"></div>
<div class="" id="ui-calendar"></div>
<div class="lista-treinamento">
<span class="error">Não existem treinamentos para este dia.</span>
<span class="load">Carregando Treinamentos...</span>
<table cellpadding="0" cellspacing="0" id="treinamentos"></table>
</div>