bootstrap-year-calendar icon indicating copy to clipboard operation
bootstrap-year-calendar copied to clipboard

Custom Day Number (Text) using customDataSourceRenderer

Open juppinger0 opened this issue 5 years ago • 2 comments

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):

`

Bootstrap Example

`

Thanks in advance! jupi

juppinger0 avatar Jul 30 '18 15:07 juppinger0

Can you provide a clear example please.

You can create a fiddle based on https://jsfiddle.net/3vb4dmpj/

Paul-DS avatar Oct 04 '18 18:10 Paul-DS

@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?

Rbalyk avatar Apr 13 '21 17:04 Rbalyk