Hide next and previous month dates in year View

How can I hide next and previous month dates in year View.
Thanks in Advance!

Hi,

Please hightlight dates that you need to hide on the screenshot.
https://docs.dhtmlx.com/scheduler/year_view.html

kurum

For All months. and only for year view.

To check the active view use getState() method
https://docs.dhtmlx.com/scheduler/api__scheduler_getstate.html
The code below can solve the issue:

scheduler.attachEvent("onViewChange", function (new_mode , new_date){
  if(scheduler.getState().mode == "year"){
	addEmptyText(".dhx_before .dhx_month_head")
	addEmptyText(".dhx_after .dhx_month_head")
  }
})

function addEmptyText(selector){
  var els = document.querySelectorAll(selector);
  for(var i=0;i<els.length;i++){
    els[i].innerHTML ='';
  }
}

Here is thee demo that demonstrates how it works:
https://snippet.dhtmlx.com/f8626c528

2 Likes

Thanks a lot! It worked like a charm. :smiley: