Last active
April 26, 2016 03:16
-
-
Save pbse/d7c2e8510673d2cd6446 to your computer and use it in GitHub Desktop.
Fullcalendar in Backbone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| data = [{ | |
| "start": "2015-06-20 15:00:00", | |
| "end": "2015-06-20 16:00:00", | |
| "title": "Java" | |
| }, { | |
| "start": "2015-06-20 15:00:00", | |
| "end": "2015-06-20 16:00:00", | |
| "title": "Java" | |
| }, { | |
| "start": "2015-06-20 15:00:00", | |
| "end": "2015-06-20 16:00:00", | |
| "title": "Java" | |
| }]; | |
| Service = Backbone.Model.extend({ | |
| defaults: { | |
| title: null, | |
| start: null, | |
| end: null | |
| } | |
| }); | |
| ServiceCollection = Backbone.Collection.extend({ | |
| model: Service, | |
| }); | |
| App = Backbone.View.extend({ | |
| initialize: function() { | |
| this.model = new Service(); | |
| }, | |
| render: function() { | |
| $('#calendar').fullCalendar({ | |
| header: { | |
| left: 'prev,next today', | |
| center: 'title', | |
| right: 'month,basicWeek,basicDay', | |
| ignoreTimezone: false | |
| }, | |
| selectable: true, | |
| selectHelper: true, | |
| editable: true, | |
| ignoreTimezone: false, | |
| }); | |
| $('#calendar').fullCalendar("addEventSource", this.collection.toJSON()); | |
| } | |
| }); | |
| var myCollection = new ServiceCollection(data); | |
| new App({ | |
| collection: myCollection | |
| }).render(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment