DHTMLX/gantt

update 6.0 error getResourceAssignments is not defined

Sapphire2k opened this issue · 11 comments

Just import dhtmlxgantt.js and init

common.js.js:789 ReferenceError: getResourceAssignments is not defined
    at r (dhtmlxgantt.js?a6f4:4213)
    at Array.t.exports (dhtmlxgantt.js?a6f4:4266)
    at t.exports (dhtmlxgantt.js?a6f4:4470)
    at t.exports (dhtmlxgantt.js?a6f4:8629)
    at Object.getGanttInstance (dhtmlxgantt.js?a6f4:8636)
    at Object.eval (dhtmlxgantt.js?a6f4:8645)
    at i (dhtmlxgantt.js?a6f4:16)
    at eval (dhtmlxgantt.js?a6f4:43)
    at eval (dhtmlxgantt.js?a6f4:44)
    at Object.3843 (1.js:1329)

Hi,
looks like this stack trace if from a different build of gantt (not 6.0 GPL located in this repo).

getResourceAssignments seems working on my end or at least is defined. Also, build in this repo doesn't have getGanttInstance definition which I see in the stack trace.

Can you pls send attach a complete demo or give more details on the version you use?

Thanks for Replying,
Yep, i use the Pro in the Vue SCF, here's the screenshot of demo i used

image

sorry, I still can't reproduce it

  1. I took our demo from here
    https://github.com/DHTMLX/vue-gantt-demo

  2. copied an Enterprise build of dhtmlx gantt into components/js directory

  3. Inside Gantt.vue

import './js/dhtmlxgantt'

and

<style>
  @import "./js/dhtmlxgantt.css";
</style>
  1. npm run dev

Everything seemed working as expected
https://www.screencast.com/t/O01Ml7fRiE8p

is there anything else I can try?

@AlexKlimenkov i try to reproduce it online, it works..
And i also turn back to 5.2, it also works.. maybe my env is lower than official request..

I find that <script src="static/js/dhtmlxgantt.js"></script> must be loaded firstly..
So when i put it in the index.html, it works...

Well, I'm still out of ideas

The one place where getResourceStore is referenced in the package is in method definition:

https://github.com/DHTMLX/gantt/blob/6.0.0/codebase/sources/dhtmlxgantt.js#L9487-L9516

...

	getResourceAssignments = function(resourceId, taskId){
		...
	};

	return {
		renderLine: renderResourceLine,
		renderHistogram: renderResourceHistogram,
		filterTasks: getTaskBy,
		getResourceAssignments: getResourceAssignments
	};
}

module.exports = function(gantt){
	var methods = createResourceMethods(gantt);

	gantt.getTaskBy = methods.filterTasks;
	gantt.getResourceAssignments = methods.getResourceAssignments;

And it's not referenced or called from anywhere else inside the library.
So if the error happens on plain gantt.init call without any extra code - then I don't have any clues how it can happen.
If all works or when you add js to index.html and fails when you import it from code - it might be related to webpack settings. Maybe something in our code gets broken after being repacked. But I can't see how it can happen.

Does it happen in one specific project or can you make a new project with the same issue? If you can send me a project which I can run locally and see the error I'll be able to check whether it's something on our end

Emmm, i reproduce it, here it's the repo: git@github.com:Sapphire2k/test-gantt.git
It will take a little time~

npm i 
npm serve

image

Great, thanks!
I've reproduced the error - I can see the error from your screenshot when I use gantt 6.0 and no error on gantt 5.2.
So it looks like the latest gantt build is not compatible with the latest webpack (or at least with settings used in basic vue project), which is not too good.

Adding gantt via <script> tag seems to be an okay workaround for now.
We'll look into the issue from our end, most likely we'll have an updated build pretty soon.

Same problem with packing

Hi,
it should be fixed in gantt 6.0.2 released just yesterday
https://dhtmlx.com/blog/maintenance-release-dhtmlxgantt-6-0-2-pro/

The free version (this repo) will be updated a bit later, unfortunately.