FireBase Adapter for Real-Time Apps with dhtmlxScheduler

| Comments (3)

Some time ago we shared our first Firebase adapter created for dhtmlxGantt. And today we’d like to share the similar one, but for dhtmlxScheduler.

Well, if you still didn’t meet Firebase, then you should know that it provides a realtime database and backend as a service. The service provides application developers an API that allows application data to be synchronized across clients and stored on Firebase’s cloud.

dhtmlxScheduler + Firebase = … ?

scheduler-firebase-img

… Dynamic Event Calendar in your app. The changes that were made in your application will be sent to the server and then sync with all users of your app. Those users who are offline will get these changes when their app regains connectivity.

To start getting advantages from this integration, we offer you to use our Firebase adapter that you may download from github. The package also includes samples and instructions which we’d also like to share here.

How to use

Step 1. We begin with including dhtmlxScheduler and Firebase files on the page:

Download dhtmlxScheduler
Download Firebase adapter for Scheduler

<!-- dhtmlxScheduler -->
<script src="../source/dhtmlx_scheduler/sources/dhtmlxscheduler.js"></script>
<link rel="stylesheet" href="../source/dhtmlx_scheduler/sources/skins/dhtmlxscheduler.css">

<!-- dhtmlxScheduler-Firebase adapter -->
<script type="text/javascript" src="../source/dhtmlx_scheduler_firebase.js"></script>

<!-- FireBase -->
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>

Step 2. In this step we create html for dhtmlxScheduler:

    <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>

Step 3. Now it’s time to init dhtmlxScheduler:

scheduler.init("scheduler_here");

Step 4. And the final step is to create firebase connection and set this to scheduler:

Note: we used our test base. Your need to create your own base on firebase.com and use your URL.

    var data = new Firebase("https://dhtmlxschedulertest.firebaseio.com"),
        events = data.child("events");

    scheduler.firebase(events);

These simple 4 steps show you how to add Event Calendar to your Firebase application. Don’t hesitate to share your opinion in the comment section below.

Thanks for reading!

Comments

  1. John September 11, 2015 at 2:24 am

    FireBase is a good DB, however it is not open source and it is completely dependent on Google. Google closed a lot of projects in the past and if Google decide to close FireBase for some reason, it will be VERY VERY DIFFICULT to replace it with something else, because it works so differently comparing to other databases. So, I would not recommend to use it due to high risks associated with this DB or at least not until Google makes it open source and there will be some free contributors.

  2. Dan April 4, 2017 at 1:55 am

    Is this adapter still supported in 2017 with the current version of Firebase? Especially after 3.X SDK update? (RE: https://firebase.google.com/support/guides/firebase-web)

    Can this blogpost be updated to reflect the latest Firebase? Thanks

    • Aras Kairys (DHTMLX team) April 4, 2017 at 2:42 pm

      Hi Dan,
      Unfortunately, this adapter wasn’t tested with the latest version of Firebase. If there were some big changes, most likely it won’t work properly.
      We’ll work on the update for the Firebase adapter, but we can’t specify the date when it will be released.

Leave a Reply