{"id":2956,"date":"2015-09-08T17:57:58","date_gmt":"2015-09-08T13:57:58","guid":{"rendered":"http:\/\/www.dhtmlx.com\/blog\/?p=2956"},"modified":"2023-05-05T13:37:13","modified_gmt":"2023-05-05T10:37:13","slug":"firebase-adapter-real-time-apps-dhtmlxscheduler","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/firebase-adapter-real-time-apps-dhtmlxscheduler\/","title":{"rendered":"FireBase Adapter for Real-Time Apps with dhtmlxScheduler"},"content":{"rendered":"<p>Some time ago we shared our first <a href=\"https:\/\/dhtmlx.com\/blog\/use-dhtmlx-gantt-chart-with-firebase\/\" target=\"_blank\">Firebase adapter created for dhtmlxGantt<\/a>. And today we&#8217;d like to share the similar one, but for <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxScheduler\/\" target=\"_blank\">dhtmlxScheduler<\/a>.<\/p>\n<p>Well, if you still didn&#8217;t meet <a href=\"https:\/\/firebase.google.com\/\" target=\"_blank\">Firebase<\/a>, then you should know that it provides a real-time 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&#8217;s cloud.<\/p>\n<h3><strong>dhtmlxScheduler + Firebase = \u2026 ?<\/strong><\/h3>\n<p><\/p>\n<p><a href=\"https:\/\/dhtmlx.com\/blog\/firebase-adapter-real-time-apps-dhtmlxscheduler\/\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/09\/scheduler-firebase-img.png\" alt=\"scheduler-firebase-img\" width=\"600\" height=\"311\" class=\"aligncenter size-full wp-image-2957\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/09\/scheduler-firebase-img.png 600w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/09\/scheduler-firebase-img-300x155.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><br \/>\n<!--more--><br \/>\n\u2026 Dynamic Scheduling 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.<\/p>\n<p>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\u2019d also like to share here.<\/p>\n<h3><strong>How to use<\/strong><\/h3>\n<p>\n<strong>Step 1.<\/strong> We begin with including dhtmlxScheduler and Firebase files on the page:<\/p>\n<blockquote><p><a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxScheduler\/download.shtml\" target=\"_blank\">Download dhtmlxScheduler<\/a><br \/>\n<a href=\"https:\/\/github.com\/DHTMLX\/firebase-scheduler\" target=\"_blank\">Download Firebase adapter for Scheduler<\/a><\/p><\/blockquote>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"sy0\">&lt;!--<\/span> dhtmlxScheduler <span class=\"sy0\">--&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>script src<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;..\/source\/dhtmlx_scheduler\/sources\/dhtmlxscheduler.js&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>script<span class=\"sy0\">&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>link rel<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;stylesheet&quot;<\/span> href<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;..\/source\/dhtmlx_scheduler\/sources\/skins\/dhtmlxscheduler.css&quot;<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\n<span class=\"sy0\">&lt;!--<\/span> dhtmlxScheduler<span class=\"sy0\">-<\/span>Firebase adapter <span class=\"sy0\">--&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>script type<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;text\/javascript&quot;<\/span> src<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;..\/source\/dhtmlx_scheduler_firebase.js&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>script<span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\n<span class=\"sy0\">&lt;!--<\/span> FireBase <span class=\"sy0\">--&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>script src<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;https:\/\/cdn.firebase.com\/js\/client\/2.2.4\/firebase.js&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>script<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>\n<strong>Step 2.<\/strong> In this step we create html for dhtmlxScheduler:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">&nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div id<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;scheduler_here&quot;<\/span> <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_container&quot;<\/span> style<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;width: 100%; height: 500px;&quot;<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_navline&quot;<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_prev_button&quot;<\/span><span class=\"sy0\">&gt;&amp;<\/span>nbsp<span class=\"sy0\">;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_next_button&quot;<\/span><span class=\"sy0\">&gt;&amp;<\/span>nbsp<span class=\"sy0\">;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_today_button&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_date&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_tab&quot;<\/span> name<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;day_tab&quot;<\/span> style<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;right: 332px;&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_tab&quot;<\/span> name<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;week_tab&quot;<\/span> style<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;right: 268px;&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_tab&quot;<\/span> name<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;month_tab&quot;<\/span> style<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;right: 204px;&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_tab&quot;<\/span> name<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;year_tab&quot;<\/span> style<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;right: 140px;&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_header&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;<\/span>div <span class=\"kw5\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;dhx_cal_data&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>\n<strong>Step 3.<\/strong> Now it&#8217;s time to init dhtmlxScheduler:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">scheduler.<span class=\"me1\">init<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;scheduler_here&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>\n<strong>Step 4.<\/strong> And the final step is to create firebase connection and set this to scheduler:<\/p>\n<blockquote><p>Note: we used our test base. Your need to create your own base on <a href=\"https:\/\/firebase.google.com\/\" target=\"_blank\">firebase.com<\/a> and use your URL.<\/p><\/blockquote>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">&nbsp; &nbsp; <span class=\"kw1\">var<\/span> data <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> Firebase<span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;https:\/\/dhtmlxschedulertest.firebaseio.com&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; events <span class=\"sy0\">=<\/span> data.<span class=\"me1\">child<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;events&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; &nbsp; scheduler.<span class=\"me1\">firebase<\/span><span class=\"br0\">&#40;<\/span>events<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>These simple 4 steps show you how to add Scheduler to your Firebase application. Don&#8217;t hesitate to share your opinion in the comment section below.<\/p>\n<p>Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some time ago we shared our first Firebase adapter created for dhtmlxGantt. And today we&#8217;d like to share the similar one, but for dhtmlxScheduler. Well, if you still didn&#8217;t &#8230;<\/p>\n","protected":false},"author":2,"featured_media":3415,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,71,1,38],"tags":[33,47,14,15],"class_list":["post-2956","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-posts-for-codeproject-com","category-tutorials","category-uncategorized","category-visible","tag-all-posts","tag-firebase","tag-tips","tag-dhtmlxscheduler"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/comments?post=2956"}],"version-history":[{"count":3,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2956\/revisions"}],"predecessor-version":[{"id":10678,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2956\/revisions\/10678"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/3415"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=2956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=2956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=2956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}