{"id":2872,"date":"2015-06-17T17:11:38","date_gmt":"2015-06-17T13:11:38","guid":{"rendered":"http:\/\/www.dhtmlx.com\/blog\/?p=2872"},"modified":"2023-05-05T13:41:06","modified_gmt":"2023-05-05T10:41:06","slug":"use-dhtmlxscheduler-meteorjs-based-apps","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/use-dhtmlxscheduler-meteorjs-based-apps\/","title":{"rendered":"How to Use DHTMLX Scheduler in Meteor JS Based Apps"},"content":{"rendered":"<p>We&#8217;ve already described how to integrate <a href=\"https:\/\/dhtmlx.com\/blog\/using-dhtmlx-gantt-chart-meteorjs-framework\/\" target=\"_blank\">dhtmlxGantt with Meteor Framework<\/a>, and this time we&#8217;ll share quite similar instructions on how to use our <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxScheduler\/\" target=\"_blank\">JavaScript Scheduler<\/a> with MeteorJS.<\/p>\n<p><a href=\"\/\/dhtmlx.com\/docs\/products\/dhtmlxScheduler\/download.shtml\" onclick=\"ga('send', 'event', 'link', 'click', 'download-scheduler-meteor-blog')\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2013\/11\/download-scheduler-banner.png\" alt=\"download scheduler\" width=\"900\" height=\"300\" class=\"aligncenter size-full wp-image-3704\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2013\/11\/download-scheduler-banner.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2013\/11\/download-scheduler-banner-300x100.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2013\/11\/download-scheduler-banner-768x256.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><!--more--><br \/>\nFor those who didn&#8217;t meet and work with <a href=\"https:\/\/www.meteor.com\/\" target=\"_blank\">MeteorJS<\/a> earlier, we remind that it&#8217;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.<\/p>\n<p><strong>Our Aim and Benefits<\/strong><\/p>\n<p>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\u2019d like to specify why you may need dhtmlxScheduler and Meteor integration and what you&#8217;ll get from it.<\/p>\n<p>&#8211; 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&#8217;s really time-saving thing.<\/p>\n<p>&#8211; As you already know, MeteorJS provides the ability for the end users to see all the changes in real-time. In our case, they&#8217;ll have the ability to follow the changes of appointments, timetables, events, etc. <\/p>\n<p>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:<\/p>\n<p><strong>(1) Special dhtmlxScheduler package for Meteor<\/strong><\/p>\n<p>You don&#8217;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:<\/p>\n<p>1. Add this <a href=\"https:\/\/atmospherejs.com\/dhtmlx\/scheduler-data\" target=\"_blank\">dhtmlxScheduler 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>scheduler<\/div><\/div>\n<p>2. Initialize dhtmlxScheduler 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; <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\">'width:100%; height:500px;'<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n&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; <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; <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; <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; <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; <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; <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; <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; <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; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&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;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&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;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; <span class=\"sy0\">&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\">scheduler.<span class=\"me1\">init<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;scheduler_here&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"kw1\">new<\/span> <span class=\"kw4\">Date<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>This is it. Note that in this case you\u2019ll need to set the communication with database by yourself to get that cool real-time feature. So, let&#8217;s see so-called &#8220;full version&#8221;.<\/p>\n<p><strong>(2) Meteor data adapter for dhtmlxScheduler<\/strong><\/p>\n<p>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.<\/p>\n<p>1. Add the <a href=\"https:\/\/atmospherejs.com\/dhtmlx\/scheduler-data\" target=\"_blank\">dhtmlxScheduler data adapter<\/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>scheduler<span class=\"sy0\">-<\/span>data<\/div><\/div>\n<p>2. Define data collections as usual:<\/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><\/div><\/div>\n<p>3. Initialize dhtmlxScheduler and data adapter:<\/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;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\">'width:100%;height:500px;'<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n&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; <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; <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; <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; <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; <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; <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; <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; <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; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&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;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&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;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"sy0\">&lt;\/<\/span>div<span class=\"sy0\">&gt;<\/span><br \/>\n&nbsp; <span class=\"sy0\">&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\">Meteor.<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 dhtmlxScheduler.<\/span><br \/>\n&nbsp; scheduler.<span class=\"me1\">init<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;scheduler_here&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"kw1\">new<\/span> <span class=\"kw4\">Date<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<br \/>\n&nbsp; <span class=\"co1\">\/\/Init dhtmlxScheduler data adapter.<\/span><br \/>\n&nbsp; scheduler.<span class=\"me1\">meteor<\/span><span class=\"br0\">&#40;<\/span>TasksCollection<span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp; <span class=\"co1\">\/\/or<\/span><br \/>\n&nbsp; scheduler.<span class=\"me1\">meteor<\/span><span class=\"br0\">&#40;<\/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> TasksCollection<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>And this is it. All these instructions are also available on github: <a href=\"https:\/\/github.com\/DHTMLX\/meteor-scheduler\" target=\"_blank\">scheduler package for meteor<\/a> and <a href=\"https:\/\/github.com\/DHTMLX\/meteor-scheduler-data\" target=\"_blank\">data adapter<\/a>.<\/p>\n<p>You&#8217;re welcome to share your experience and ask any questions. More new interesting and useful tutorials are coming soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve already described how to integrate dhtmlxGantt with Meteor Framework, and this time we&#8217;ll share quite similar instructions on how to use our JavaScript Scheduler with MeteorJS.<\/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,14,44,15],"class_list":["post-2872","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-tips","tag-meteor","tag-dhtmlxscheduler"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2872","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=2872"}],"version-history":[{"count":2,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2872\/revisions"}],"predecessor-version":[{"id":10681,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/2872\/revisions\/10681"}],"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=2872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=2872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=2872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}