From the version 4.0, the library provides a special extension mvc that allows you to integrate the scheduler with the Backbone library.
If you have a Backbone-based application and want to add the scheduler there (still managing data with Backbone), use the following technique:
<script src="../../codebase/dhtmlxscheduler.js" ></script>
<link rel="stylesheet" href="../../codebase/dhtmlxscheduler.css">
scheduler.plugins({
mvc: true
});
scheduler.full_day = true;
scheduler.init("scheduler_here",new Date(2019,0,6),"month");
//you can use any model here
MyEvent = Backbone.Model.extend({});
EventList = Backbone.Collection.extend({
model:MyEvent,
url:"./data/backbone.json"
});
events = new EventList();
scheduler.backbone(events); //link scheduler to collection
After that scheduler will load data from collection and will reflect any updates in it. Also, any changes through scheduler's UI will trigger related events in the backbone's collection.
As you see, it's fairy simple. All you need is to use the backbone method instead of usual load or parse ones.
The backbone method makes the scheduler reflect all data changes in the Backbone model and vice versa.
As a parameter, the method takes a Backbone collection.
Related sample: Backbone integration
Back to top