I am using gantt.load to load tasks from a database.
In my dev environment everything works fine, tasks get loaded correctly, but not in my prod environment.
The code is the same, the database call and data returned from that call is also the same, but on the gantt, although the tasks appear, I can’t edit any of them (double click to edit does nothing) and I don’t have a start date.
I’ve been debugging and so far I only notice a difference from one environment to another: my tasks json object in dev keeps numbers as integers:
While on prod:
And I have no idea why this is happening, but I guess it must have an impact.
Thanks in advance!
Yes, it affects how everything works.
Duration can only accept integer parameters. If tasks do not have start_date, they try to take the date from its children.
You can try converting the necessary values to have the correct type. You need to have integer duration and string/Date start_date.
If you do not have start_date deliberately, you need to unschedule tasks.
In the following example you can see how to modify the values before parsing the data:
As usual, you came and helped a lot!
Please check this: http://snippet.dhtmlx.com/4aea22192
I used the ontaskloading event and parsed all the needed fields from strings to numbers. The problem is that now all the other fields (name, date, etc) stay empty.
I thought I was only updating the task, but it seems that I’m creating a new version of the task? Can you please explain what happens in this event?
I was not properly checking the indexOf method…
Here’s the updated snippet: http://snippet.dhtmlx.com/e90948a55
Everything is working now. You can close the issue.