{"id":2832,"date":"2015-05-15T15:29:00","date_gmt":"2015-05-15T11:29:00","guid":{"rendered":"http:\/\/www.dhtmlx.com\/blog\/?p=2832"},"modified":"2023-05-05T13:41:39","modified_gmt":"2023-05-05T10:41:39","slug":"using-dhtmlx-gantt-chart-meteorjs-framework","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/using-dhtmlx-gantt-chart-meteorjs-framework\/","title":{"rendered":"Using DHTMLX Gantt Chart with MeteorJS Framework"},"content":{"rendered":"<p><a href=\"https:\/\/www.meteor.com\/\" target=\"_blank\">MeteorJS<\/a> is 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.<\/p>\n<p>On the client, Meteor can be integrated with any JavaScript UI library and we have managed to simplify using of dhtmlxGantt with this framework.<\/p>\n<p><a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxGantt\/download.shtml\" onclick=\"ga('send', 'event', 'link', 'click', 'download-gantt-meteor-blog')\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2016\/08\/download-gantt-banner.png\" alt=\"download gantt\" width=\"900\" height=\"300\" class=\"aligncenter size-full wp-image-3693\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2016\/08\/download-gantt-banner.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2016\/08\/download-gantt-banner-300x100.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2016\/08\/download-gantt-banner-768x256.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><br \/>\n<!--more--><\/p>\n<h3><strong>Why you may need this?<\/strong><\/h3>\n<p>\nIf you create a project management application (with <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxGantt\/\" target=\"_blank\">Gantt chart<\/a> in our case) and use Meteor Web Framework, the end users of this app will be able to see all the changes of the charts in real-time.  Business analysts and project managers would highly appreciate this ability &#8211; monitoring of the whole project process would be faster and more productive.<\/p>\n<p>Leaving aside many words about the benefits of this integration, let&#8217;s move on to the technical part. Here we have two options:<\/p>\n<p><strong>(1) Special dhtmlxGantt package for Meteor<\/strong><\/p>\n<p>In general, you may download the package from our website and integrate it in your Meteor app, but it will require much more additional work: go to the website each time when the version is updated, download the package, unpack, include it, etc. That\u2019s why we created a special package which requires only two small steps to start using dhtmlxGantt with Meteor:<\/p>\n<p>Step 1. Add this <a href=\"https:\/\/atmospherejs.com\/dhtmlx\/gantt\" target=\"_blank\">dhtmlxGantt package<\/a>:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">meteor add dhtmlx<span class=\"sy0\">:<\/span>gantt<\/div><\/div>\n<p>Step 2. Initialize dhtmlxGantt component:<\/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>body<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; &nbsp; <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\">'width: 100%; height: 500px;'<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;\/<\/span>body<span class=\"sy0\">&gt;<\/span><\/div><\/div>\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>This is it. Note that in this case you&#8217;ll need to set the communication with database by yourself to get that cool real-time feature.<\/p>\n<p>But we wouldn&#8217;t write this post without providing you the ready solution for this feature, and that&#8217;s why let&#8217;s look at the option 2.<\/p>\n<p><strong>(2) Meteor data adapter for dhtmlxGantt<\/strong><\/p>\n<p>The following instructions will help you to set up dhtmlxGantt in the way that data in the chart updates live on the screen as it changes.<\/p>\n<ul>\n<li>Add the <a href=\"https:\/\/atmospherejs.com\/dhtmlx\/gantt-data\" target=\"_blank\">dhtmlxGantt data adapter<\/a>:<\/li>\n<\/ul>\n<p><\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">meteor add dhtmlx<span class=\"sy0\">:<\/span>gantt<span class=\"sy0\">-<\/span>data<\/div><\/div>\n<p><\/p>\n<ul>\n<li>Define data collections as usual:<\/li>\n<\/ul>\n<p><\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\">TasksCollection <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> Mongo.<span class=\"me1\">Collection<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;tasks&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\nLinksCollection <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> Mongo.<span class=\"me1\">Collection<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;links&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><\/p>\n<ul>\n<li>Initialize dhtmlxGantt and data adapter:<\/li>\n<\/ul>\n<p><\/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>body<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; <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\">'width: 100%; height: 500px;'<\/span><span class=\"sy0\">&gt;&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n<span class=\"sy0\">&lt;\/<\/span>body<span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\nMeteor.<span class=\"me1\">startup<\/span><span class=\"br0\">&#40;<\/span><span class=\"kw1\">function<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; <span class=\"co1\">\/\/Init dhtmlxGantt.<\/span><br \/>\n&nbsp; 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><br \/>\n<br \/>\n&nbsp; <span class=\"co1\">\/\/Init dhtmlxGantt data adapter.<\/span><br \/>\n&nbsp; gantt.<span class=\"me1\">meteor<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#123;<\/span>tasks<span class=\"sy0\">:<\/span> TasksCollection<span class=\"sy0\">,<\/span> links<span class=\"sy0\">:<\/span> LinksCollection<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; <span class=\"co1\">\/\/or<\/span><br \/>\n&nbsp; gantt.<span class=\"me1\">meteor<\/span><span class=\"br0\">&#40;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span>tasks<span class=\"sy0\">:<\/span> TasksCollection.<span class=\"me1\">find<\/span><span class=\"br0\">&#40;<\/span><span class=\"coMULTI\">\/*[anything]*\/<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">,<\/span> links<span class=\"sy0\">:<\/span> LinksCollection.<span class=\"me1\">find<\/span><span class=\"br0\">&#40;<\/span><span class=\"coMULTI\">\/*[anything]*\/<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#123;<\/span>tasks<span class=\"sy0\">:<\/span> TasksCollection<span class=\"sy0\">,<\/span> links<span class=\"sy0\">:<\/span> LinksCollection<span class=\"br0\">&#125;<\/span><br \/>\n&nbsp; <span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>That&#8217;s all. Now you can enjoy having nice-looking gantt chart in your Meteor app. Soon we&#8217;ll share the similar instructions for dhtmlxScheduler integration with MeteorJS. Stay tuned!<\/p>\n<blockquote>\n<h5>What would you like to see in our next articles about dhtmlxGantt?<\/h5>\n<p>We need your feedback to provide the right integrations at the right time. Please leave your requests here: <\/p>\n<p><a class=\"typeform-share button\" href=\"https:\/\/dhtmlx.typeform.com\/to\/D3AU2V\" data-mode=\"drawer_right\" style=\"display:inline-block;text-decoration:none;background-color:#267DDD;color:white;cursor:pointer;font-family:Helvetica,Arial,sans-serif;font-size:16px;line-height:40px;text-align:center;margin:0;height:40px;padding:0px 26px;border-radius:20px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:bold;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;\" target=\"_blank\">Request Integration <\/a> <script> (function() { var qs,js,q,s,d=document, gi=d.getElementById, ce=d.createElement, gt=d.getElementsByTagName, id=\"typef_orm_share\", b=\"https:\/\/embed.typeform.com\/\"; if(!gi.call(d,id)){ js=ce.call(d,\"script\"); js.id=id; js.src=b+\"embed.js\"; q=gt.call(d,\"script\")[0]; q.parentNode.insertBefore(js,q) } })() <\/script><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>MeteorJS is 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 &#8230;<\/p>\n","protected":false},"author":2,"featured_media":3798,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,71,1,38],"tags":[33,20,60,44],"class_list":["post-2832","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-gantt","tag-integrations-gantt","tag-meteor"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2832","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=2832"}],"version-history":[{"count":1,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2832\/revisions"}],"predecessor-version":[{"id":11400,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2832\/revisions\/11400"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/3798"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=2832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=2832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=2832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}