search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Calendar Month in viewtype=week

Asked by Alberto Barbero
12 days ago.

After i have set cellMode=true i receive this error :

Uncaught TypeError: Cannot read properties of undefined (reading '0')

2 other people also want an answer.
Comment posted by Dan Letecky [DayPilot]
12 days ago.

Unfortunately, I'm not able to reproduce the problem.

Could you please post your config and the steps required to reproduce the issue?

Comment posted by Anonymous
11 days ago.

Hi,

I have defined a class, so simply create an object class and call the method dpinit().

Alberto

class CalendarPilot
{
    constructor(InsertEvent,SelectStartDate)
    {        
        this.InsertEvent=InsertEvent;	
		this.SelectStartDate=SelectStartDate;
		//this.dpDiv = document.getElementById('dp');		
		this.dp=new DayPilot.Month('dp'); 
        this.dp.cellMode=true;		
		this.dp.viewType="Weeks";
		this.dp.weeks=1;
		this.dp.locale="it-ch";
		this.dp.allDayend="Date";
		
		this.dp.onTimeRangeSelected = (args) => 
		{
           if (this.InsertEvent !== undefined)
               this.InsertEvent(args.start, args.end);
           else
              alert(`InsertEvent value: "${args.start}". Missing InsertEvent function in constructor.`);  		         
        };
		
		this.Navdp=new DayPilot.Navigator('nv');							
		this.Navdp.selectMode = "week";
		this.Navdp.locale="it-ch";
		
		this.Navdp.onTimeRangeSelected = (args) => 
		{
           if (this.SelectStartDate !== undefined)
               this.SelectStartDate(args.start);
           else
              alert(`SelectStartDate value: "${args.start}". Missing SelectStartDate function in constructor.`);  
        };
	}
	
	dpAddEvent(evstart,evend,EventText)
	{
	      this.dp.clearSelection();
          if (!EventText) return;
          var e = new DayPilot.Event({
              start: evstart,
              end: evend,
              id: DayPilot.guid(),
              text: EventText
          });
          this.dp.events.add(e);	
	}	
	
	dpInit()
    {       
		//this.dp.minCellHeight=300;
		//this.dp.startDate = DayPilot.Date.today().addDays(7);	        	
        //this.dp.width="95%";		
		this.dp.init();
        this.Navdp.init();         		         		
    }
	
	dpUpdate(startDate)
	{
	  this.dp.startDate = startDate;
      this.dp.update();	  
	}
   
}
Comment posted by Dan Letecky [DayPilot]
11 days ago.

Hi Alberto,

Thanks for the update. This configuration seems to work fine. Could you please give it a try with the latest version (2022.3.5439).

Also, does it happen when you load a specific event? I assume you see the error during page initialization.

Comment posted by Anonymous
11 days ago.

I have already the last version and yes the error is during page initialization..

Alberto

Comment posted by Dan Letecky [DayPilot]
11 days ago.

Does it happen if you don't load any events?

Comment posted by Anonymous
11 days ago.

I don't add any event the calendar is empty..

Answer posted by Dan Letecky [DayPilot]
11 days ago.

Thanks for the update.

It should be fixed now in the latest sandbox build (2022.3.5440):
https://release.daypilot.org/changes/js/

Please let me know if the problem persists.

Comment posted by Anonymous
11 days ago.

now thats all ok!
I have a problem with minCellHeight=300 seems don't work but i think the problem is related with Daypilot library.

thanks,

Comment posted by Dan Letecky [DayPilot]
11 days ago.
Comment posted by Anonymous
11 days ago.

Oks, thanks.

Alberto

New Reply
This reply is
Your name (optional):