Scheduler with vue js


i wanna use scheduler in vue js, i installed the trial package with npm and import it in my component, i configured scheduler but in console i got ‘dhtmlx is not defined’ error from .

vue-router.esm.js?8c4f:1921 ReferenceError: dhtmlx is not defined
at eval (dhtmlxscheduler.js?a149:11)
at eval (dhtmlxscheduler.js?a149:313)
at Module…/dhtmlx-scheduler/dhtmlxscheduler.js (15.js:11)
any idea whats the problem?



Unfortunately, we don’t have a tutorial for dhtmlxScheduler with vue js at the moment.
Currently I can suggest you try to follow similar steps from the tutorial for the dhtmx Gantt chart: https://dhtmlx.com/blog/use-dhtmlxgantt-vue-js-framework-demo/
Hope that will solve the issue.

Regarding the error -
The common error for the Scheduler is scheduler is not defined. Which command do you use that starts from the word dhtmlx in your app?


i figured that out, scheduler isn’t compatible with webpack as used with vue.
scheduler.js uses global variable in window without declaration and because of that when webpack tries to compile scheduler.js that imported to vue component got dhtmlx and many other vars undefined.
i defined those variables in scheduler.js and i did skip this issue and config scheduler and it works but next i got a few more issues.
at the end i used cdn since its not workin with import and doesnt have an official vue wrapper.
now im using it in vue but the integration is a little bit messy.


im using checkEvent method to see if an event is attached; if not use attachEvent.but every time it returns true even the first time, the code is like this:

console.log(‘onEventAdded’, scheduler.checkEvent(‘onEventAdded’)) // ‘onEventAdded’, true
if (!scheduler.checkEvent(‘onEventAdded’)) {
console.log(‘onEventAdded created’)// never get here
scheduler.attachEvent(‘onEventAdded’, (id, e) => {
eventService.create(e).catch(() => {
e.type = ‘not_saved’;
dhtmlx.alert(‘Data did not saved!’);

so it is a bug or what? how can i face this issue?
thanks for your support