The update() method updates and redraws the component. Two update modes are supported:
1. You can make the changes by changing the properties directly:
dp.viewType = "Resources"; dp.update();
2. You can pass a set of changes using the options parameter:
dp.update({viewType: "Resources"});
This method can be called before init(). In that case it will only set the properties specified using the options parameter which will be applied during the init() call.
This method cannot be called after the component has been disposed using dispose(). In that case, an exception will be thrown.
DayPilot.Calendar.update([options]);
The options object can specify any of the standard properties and event handlers.
The following options properties have a special meaning:
An optimized partial update will be performed if the only property in the options object is one of these properties:
Example:
dp.update({events: [ { id: 1, start: "2020-10-01T12:00:00", end: "2020-10-01T14:00:00", text: "Event 1" } ]});
Loading events using the options parameter:
var data = [ { id: 1, start: DayPilot.Date.today().addHours(10), end: DayPilot.Date.today().addHours(11), text: "Event 1" }, { id: 2, start: DayPilot.Date.today().addHours(13), end: DayPilot.Date.today().addHours(16), text: "Event 2" } ]; dp.update({events: data});
Changing the calendar view type:
dp.viewType = "Day"; dp.update();