How to Use DHTMLX Scheduler in Meteor JS Based Apps

We’ve already described how to integrate dhtmlxGantt with Meteor Framework, and this time we’ll share quite similar instructions on how to use our JavaScript Scheduler with MeteorJS.

download scheduler


For those who didn’t meet and work with MeteorJS earlier, we remind that it’s an open-source real-time JavaScript web application framework written on top of Node.js. The coolest thing about it is the ability to automatically transfer data changes to clients in real-time without requiring the developer to write any synchronization code.

Our Aim and Benefits

Based in the given definition of this rapidly growing framework and with regard to the ability of its integration with any client-side library, we’d like to specify why you may need dhtmlxScheduler and Meteor integration and what you’ll get from it.

– In general, lots of applications require calendar. And if you develop with Meteor, you will have the ability to use a ready integration with modern and full-featured appointment calendar. So, it’s really time-saving thing.

– As you already know, MeteorJS provides the ability for the end users to see all the changes in real-time. In our case, they’ll have the ability to follow the changes of appointments, timetables, events, etc.

Our aim is to show and provide you the easiest way to start using dhtmlxScheduler with MeteorJS, and let Meteor fans to try our calendar. Here are two way for it:

(1) Special dhtmlxScheduler package for Meteor

You don’t need to do some actions that require much additional time and work: download the package from website, unpack, include it in your app, etc. Instead of this you just follow these small instructions:

1. Add this dhtmlxScheduler package:

meteor add dhtmlx:scheduler

2. Initialize dhtmlxScheduler component:

<body>
  <div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:500px;'>
      <div class="dhx_cal_navline">
      <div class="dhx_cal_prev_button">&nbsp;</div>
      <div class="dhx_cal_next_button">&nbsp;</div>
      <div class="dhx_cal_today_button"></div>
      <div class="dhx_cal_date"></div>
      <div class="dhx_cal_tab" name="day_tab" style="right:332px;"></div>
      <div class="dhx_cal_tab" name="week_tab" style="right:268px;"></div>
      <div class="dhx_cal_tab" name="month_tab" style="right:204px;"></div>
      <div class="dhx_cal_tab" name="year_tab" style="right:140px;"></div>
      </div>
      <div class="dhx_cal_header">
      </div>
      <div class="dhx_cal_data">
      </div>
  </div>
</body>
scheduler.init("scheduler_here", new Date());

This is it. Note that in this case you’ll need to set the communication with database by yourself to get that cool real-time feature. So, let’s see so-called “full version”.

(2) Meteor data adapter for dhtmlxScheduler

The following instructions will help you to set up dhtmlxScheduler in the way that data in the calendar updates live on the screen as it changes.

1. Add the dhtmlxScheduler data adapter:

meteor add dhtmlx:scheduler-data

2. Define data collections as usual:

TasksCollection = new Mongo.Collection("tasks");

3. Initialize dhtmlxScheduler and data adapter:

<body>
  <div id="scheduler_here" class="dhx_cal_container" style='width:100%;height:500px;'>
      <div class="dhx_cal_navline">
      <div class="dhx_cal_prev_button">&nbsp;</div>
      <div class="dhx_cal_next_button">&nbsp;</div>
      <div class="dhx_cal_today_button"></div>
      <div class="dhx_cal_date"></div>
      <div class="dhx_cal_tab" name="day_tab" style="right:332px;"></div>
      <div class="dhx_cal_tab" name="week_tab" style="right:268px;"></div>
      <div class="dhx_cal_tab" name="month_tab" style="right:204px;"></div>
      <div class="dhx_cal_tab" name="year_tab" style="right:140px;"></div>
      </div>
      <div class="dhx_cal_header">
      </div>
      <div class="dhx_cal_data">
      </div>
  </div>
</body>
Meteor.startup(function() {
  //Init dhtmlxScheduler.
  scheduler.init("scheduler_here", new Date());

  //Init dhtmlxScheduler data adapter.
  scheduler.meteor(TasksCollection);
  //or
  scheduler.meteor(TasksCollection.find(/*[anything]*/), TasksCollection);
});

And this is it. All these instructions are also available on github: scheduler package for meteor and data adapter.

You’re welcome to share your experience and ask any questions. More new interesting and useful tutorials are coming soon.

Advance your web development with DHTMLX

Gantt chart
Event calendar
Diagram library
30+ other JS components