Meteor with dhtmlx:gantt-data missing events

Hello community

i am using dhtmlx:gantt and dhtmlx:gantt-data for Meteor
everything from the example coding is working:
gantt.meteor({tasks: TasksCollection, links: LinksCollection});

now i want to manipulate the data before the gantt gets rendered.
i found the events onBeforeGanttRender and onTaskLoading which naming sounds suitable but i think there were not fired in my case?

can anyone explain me which events are available when i am using gantt.meteor ?
is there another way of integration for the meteor framework which is less tight but still reactive but does not miss the events?

is there any other of manipulating the task data?
for example i want to read the color associated to a user and color all of his tasks in his color.

i could neither find any detailed doku on google nor any sample coding.

Thanks and best regards

You can use onBeforeTaskAdd event to alter task’s data … event.html

which events are available when i am using gantt.meteor ?
All events are available, but gantt add’s item one by one, using gantt.addTask API, so instead of onTaskLoading you have the onBeforeTaskAdd event.

Hi Stanislav

thank you very much for your help. I reverted my code to use the event: onBeforeTaskAdd
within i have a lookup function for the color which corresponds to the task owner.
(the task does not have an explicit color, it is derived from the owner)
the disadvantage is that, the added color attribute triggers immediate an update to the associated collection.
the update then triggers an update of the gantt :frowning:

  • is it possible to control the fields which trigger an update of the collection (at the moment every field gets automatic synced)
  • is there an alternative way to to color the task without css (because the color comes from the database but from the user collection)
    for the task-owner i used gantt.templates.rightside_text to return the username after lookup the referenced userId.

maybe my strategy is to complicated and you can give me another hint.

your help is very much appreciated
regards Jokel

The data syncing will be triggered if you are using API to update item objects. ( updateTask for example )
You can update task silently by setting properties directly on the task object.

var task = gantt.getItem(id); task.color = "red"; gantt.render();

  • is there an alternative way to to color the task

You can use color property or a coloring template … tasks.html

Hi Stanislav

thanks for your reply. I could not find a function getItem but getTask did it for me. I applied this code and changed the color with a double lookup of the owner of a task and the color of this owner.

Thanks again and have a nice day.
Regards Jörgen

[code] gantt.meteor({tasks: TasksCollection, links: LinksCollection});

for (var k in LOOKUP[“taskOwner”])
const thisColor = LOOKUP[“userColor”][LOOKUP[“taskOwner”][k]];
if (thisColor !== undefined){
var task = gantt.getTask(k);
task.color = thisColor;
gantt.sort(“start_date”, false);[/code]