I have a well working fullcalendar script that adds css-classes to events according to data attributes via eventRender
. I now need to filter these specific attributes with checkboxes, but I have no idea at all how I should get this going!
My script looks as follows:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
eventRender: function(calEvent, element, view) {
if (calEvent.risk == "normal") {
element.css('background-color', '#99FF99');
}
if (calEvent.risk == "event") {
element.css('background-color', '#415eec');
}
if (calEvent.risk == "whisper") {
element.css('background-color', '#D7CDD5');
}
},
allDaySlot: true,
displayEventTime: true,
displayEventEnd: true,
editable: false,
firstDay: 1,
weekNumbers: true,
selectable: false,
weekNumberCalculation: "ISO",
eventLimit: true,
events: 'parts/events22.php'
});
});
</script>
The html checkboxes:
<div class="checkbox">
<label><input type="checkbox" value="normal">Normal</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="event">Event</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="whisper">Whisper</label>
</div>
Does someone know how I can connect the checkbox-values to calEvent.risk
, i.e. specific data attributes so as to filter them? Or does someone have a different idea for multiselect filtering with fullcalendar? I'd be really grateful for any help!
Aucun commentaire:
Enregistrer un commentaire