bootstrap-year-calendar
bootstrap-year-calendar copied to clipboard
Custom Day Number (Text) using customDataSourceRenderer
Hi all,
I just want to set a different style to some "special" days. So I'm playing with customDataSourceRenderer.
my problem: I want to set a different TEXT for a day. instead of the day number (eg. "31" I want to use another letter eg. "_(!)").
I played around with some code snippets but I always get the result that the popup will never appear if I change the text.
(...) style: 'custom', customDataSourceRenderer: function(element, date, events) { (...)
(...) dataSource: [ { id: 0, name: 'Google I/O', location: 'San Francisco, CA', startDate: new Date(currentYear, 4, 28), endDate: new Date(currentYear, 4, 29), typ: 'wichtig' }, (...)
`(...) $(function() { var currentYear = new Date().getFullYear();
$('#calendar').calendar({
style: 'custom',
customDataSourceRenderer: function(element, date, events) {
for (var i=0; i<events.length; i++) {
if(events[i].typ == 'wichtig') {
$(element).css('color', 'red');
$(element).text($(element).text() + "_(!)");
}
if(events[i].typ == 'unwichtig') {
$(element).css('background-color', 'green');
}
}
},
(...)`
This is my COMPLETE sample code (you should copy paste 1 by 1 for local testing):
`
`
Thanks in advance! jupi
Can you provide a clear example please.
You can create a fiddle based on https://jsfiddle.net/3vb4dmpj/
@Paul-DS I am working with your js-year-calendar its Amazing but I have little bit questions that I cant find answer. Is it possible to connect with you on 10min in skype or something else?