Difference between addTask and parse

Hi,

Like to know is there any difference between calling gantt.parse and gantt.addTask?
Both achieve the same end state, both has its own event. e.g onParse, onAfterTaskAdd and so on.

Currently, I only can think that parse can parse link together?
addTask is slower because need to add one by one?

Thanks.

Hello Joseph,
The main difference between the methods is that gantt.parse() doesn’t add the tasks on the server side. You can load any number of tasks with the gantt.parse() method, but when you reload the page, you won’t see those tasks.

Hi @ramil,

But if I am not using dataProcessor then there is basically no difference?

For parse, I can initialize my initial data set with links.
For addTask and addLink, probably use for after the initial data set has been loaded with parse.

Make sense?

There isn’t a API that addTaskAndLink right?

Hello Joseph,
In that case, the methods are very similar, except for the following things.
The addTask() method allows modifying the data on-fly. For example, you can redefine the parent. And specify the index parameter to set the position that the new task will take.
In the following example, you can see that Task #11 can be located at the bottom of the list (parse) or in between Task #1 and #2(addTask):
http://snippet.dhtmlx.com/af2539df1
Also, the parse() method allows loading the data from an XML file.

And yes, it is possible to load tasks and links when using the gantt.parse() command.

There isn’t a API that addTaskAndLink right?

There is no public API method like addTaskAndLink.

Hi @ramil

Thanks for the explanation.