{"id":2939,"date":"2015-08-25T12:29:34","date_gmt":"2015-08-25T08:29:34","guid":{"rendered":"http:\/\/www.dhtmlx.com\/blog\/?p=2939"},"modified":"2023-05-05T13:37:46","modified_gmt":"2023-05-05T10:37:46","slug":"use-dhtmlx-gantt-chart-with-firebase","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/use-dhtmlx-gantt-chart-with-firebase\/","title":{"rendered":"How to Use DHTMLX Gantt Chart with FireBase Platform"},"content":{"rendered":"<p>In this post we&#8217;d like to share the instructions that will help you to use <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxGantt\/\" target=\"_blank\">dhtmlxGantt<\/a> with Firebase. For this we developed a special adapter that you&#8217;re welcome to download from <a href=\"https:\/\/github.com\/DHTMLX\/firebase-gantt\" target=\"_blank\">github<\/a>.<\/p>\n<p><a href=\"https:\/\/firebase.google.com\/\" target=\"_blank\">Firebase<\/a> is a powerful platform that provides API for data storage and real-time synchronization, and the server where the data is stored. Moreover, it includes user authentication, static hosting, and more.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/08\/firebase-gantt.jpg\" alt=\"firebase-gantt\" width=\"600\" height=\"311\" class=\"aligncenter size-full wp-image-2940\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/08\/firebase-gantt.jpg 600w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/08\/firebase-gantt-300x155.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><br \/>\n<!--more--><\/p>\n<h3><strong>Firebase adapter for dhtmlxGantt: what for?<\/strong><\/h3>\n<p><\/p>\n<p>Some time ago real-time sync of web apps was a cool feature, but today it&#8217;s a must-have. The changes that are made in the app will be synced to all clients: both to the connected users in real-time and to those who are offline (data is synchronized instantly when your app regains connectivity). So, all the changes made to the Gantt Chart in your application will be transfered to clients working with your app.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/08\/gantt-firebase.png\" alt=\"gantt-firebase\" width=\"596\" height=\"443\" class=\"aligncenter size-full wp-image-2941\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/08\/gantt-firebase.png 596w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2015\/08\/gantt-firebase-300x222.png 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><br \/>\n<\/p>\n<h3><strong>How to use<\/strong><\/h3>\n<p><\/p>\n<p><strong>Step 1.<\/strong> First af all, we need to include dhtmlxGantt and Firebase files on the page.<\/p>\n<blockquote><p>\n<a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxGantt\/download.shtml\" target=\"_blank\">Download dhtmlxGantt<\/a><br \/>\n<a href=\"https:\/\/github.com\/DHTMLX\/firebase-gantt\" target=\"_blank\">Download Firebase adapter for Gantt<\/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> dhtmlxGantt <span class=\"sy0\">--&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;<\/span>script src<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;..\/source\/dhtmlx_gantt\/sources\/dhtmlxgantt.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_gantt\/sources\/skins\/dhtmlxgantt_skyblue.css&quot;<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\n<span class=\"sy0\">&lt;!--<\/span> dhtmlxGantt<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_gantt_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> The next step is to create html for dhtmlxGantt:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"sy0\">&lt;<\/span>div id<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;gantt_here&quot;<\/span> style<span class=\"sy0\">=<\/span><span class=\"st0\">&quot;width: 100%; height: 500px;&quot;<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>\n<strong>Step 3.<\/strong> Now we init dhtmlxGantt:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">gantt.<span class=\"me1\">init<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;gantt_here&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>\n<strong>Step 4.<\/strong> Create firebase connection and set this to the gantt.<\/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\"><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:\/\/dhtmlxgantttest.firebaseio.com\/&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">,<\/span><br \/>\ngantt.<span class=\"me1\">firebase<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#123;<\/span>tasks<span class=\"sy0\">:<\/span> data.<span class=\"me1\">child<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;tasks&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">,<\/span> links<span class=\"sy0\">:<\/span> data.<span class=\"me1\">child<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;links&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>\nWell, that&#8217;s all we need to start using dhtmlxGantt on FireBase Platform. If you have any questions\/comments, you&#8217;re welcome to leave them below.<\/p>\n<p>Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post we&#8217;d like to share the instructions that will help you to use dhtmlxGantt with Firebase. For this we developed a special adapter that you&#8217;re welcome to &#8230;<\/p>\n","protected":false},"author":2,"featured_media":3385,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,71,1,38],"tags":[33,47,20,14],"class_list":["post-2939","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-gantt","tag-tips"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2939","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=2939"}],"version-history":[{"count":2,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2939\/revisions"}],"predecessor-version":[{"id":8946,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2939\/revisions\/8946"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/3385"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=2939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=2939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=2939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}