Problem with displaying non-working days

Discuss issues related to v3.x
User avatar
VincentOP
Posts: 26
Joined: Mon May 09, 2016 2:35 pm

Re: Problem with displaying non-working days

Post by VincentOP » Fri Jun 17, 2016 10:05 am

Thank you very much Maxim, you're my hero.

I also fixed the name of CLS and it's works !

Code: Select all

        cm.on('load', function() {
			leScheduler.getPlugin('workingTime').bindCalendar(cm.getCalendarManager().getCalendar(1));
        });

User avatar
Maxim Gorkovsky
Core Developer
Core Developer
Posts: 3065
Joined: Wed Jan 08, 2014 11:46 am

Re: Problem with displaying non-working days

Post by Maxim Gorkovsky » Fri Jun 17, 2016 11:59 am

Thank you, I'm glad it's working now.

There's actually a cleaner solution, no need to reassign calendar we can create one with right id and it will be filled when crud manager is loaded:

Code: Select all

leScheduler = Ext.create('MyDashBoard.view.SchedulerPanel', {
  ...
  // if your plugin is not just a config but also has instances specified (like your calendar) it is better to move
  // it to the instance config, otherwise it won't be safely reusable
  plugins : [{
    ptype : 'scheduler_nonworkingtime',
    calendar : new Gnt.data.Calendar({ 
      // this is id of calendar as it set in your data pack for crud manager
      calendarId : '1' 
    })
  }]
});
You can do some tricks here, like try to resolve calendar before creating one. But in general this would be enough to achieve same result without listeners and use of private methods :)
I'm not sure if plugins you already defined in class declaration will be overriden by this config or not, so you should pay attention to that.

Post Reply