MiniCalendar (Problem with markCalendar() )

Hello once again,

i tried manipulate the build in mini-calendar of the scheduler. Of course i know, that the functions are only rudimental, so i realy want to block or even hide weekends from it, but i know that this is actually only possible in the real dhtmlxCalendar :slight_smile:

What is documented that it should work, is the function markCalendar(), isn’t it?

First i had a big problem to understand, how to call the resource of the calendar, once initalised by the routine, brought to us by the example-page. I figured it out like this (is it right?):

var minikalender; function show_minical(){ if (scheduler.isCalendarVisible()) { scheduler.destroyCalendar(); } else { minikalender = scheduler.renderCalendar({ position:"dhx_minical_icon", date:scheduler._date, navigation:true, handler:function(date,calendar){ scheduler.setCurrentView(date); } }); } }

Now i want to mark a date (or even a whole bunch of dates, but for this one date will be okay), by adding this line:

scheduler.markCalendar(minikalender, new Date(2015, 4, 6), "kalender_urlaube"); after });…

When i am in the correct month of the marked-day, this day (06. of May) is colored in the correct CSS-class (kalender_uralube). When i change the month with the mini-calender and change back to may, there is nothing more marked… Same if i switch FROM another month to May (for example when i open up the mini-calendar from antoher month).

What’s wrong here? Tha calendar is always newly rendered when i change months? So i have to mark the events each time again - But where (btw: Could make it little bit slow when i have a big list of events to mark :slight_smile: )…

FYI: Just want to colour holidays in the mini-calendar.

this is an expected behavior of the minicalendar. The method adds css class to the element, which will be reset when minicalendar refreshes.

In order to add persistend styles, try using template functions.
Minicalendar reuses the same templates as the month view. So you can define following template that will return a needed css class for certain days:scheduler.templates.month_date_class = function(date){ if(date.getDay() % 2)//some valid rule return "holiday"; return ""; }; … plate.html
And define a class, using dhx_year_body selector in order to enable it only for minicalendar

.dhx_year_body .holiday .dhx_month_head{ background-color:red; opacity:0.3; }

Thanks for your kind reply!

Helped me to code the following, which i want to share with the community.
If someone wants to mark every HOLIDAYS or Closing-Times or anything like this, he can surely use this snipped and change it to his needs:

It’s simple: Just generate (via php or whatever) the string closing_times_minicalendar and fill it with the dates (format is actually: yy-mm-d, but can be changed easily) that should be marked different in schedulers mini calendar.

I made this a bit further, becuase i want an holiday-beach chair in this holiday-cases. Perhaps someone can use this as well, so here is my code of this (css) and the used image (
) is as a attachement (and a screenshot of how it looks like):

.dhx_year_body .holiday{ background:url(codebase/imgs/urlaub_minikalender.png); } .dhx_year_body .holiday.dhx_month_head{ background-color:rgba(0, 0, 0, 0) !important; color: rgba(0, 0, 0, 0); }

Hope this is easy to understand? If not write me a message… Love that community <3