Page 1 of 1

Missing function to set parent on task in taskStore

Posted: Thu Jan 20, 2022 4:34 pm
by fdyrs

Hi,

How can I set parent on a task properly with validation programmatically?

I am using gantt-4.3.2

I tried the following, and it works and are triggering UI to redraw fine. But there are no validation to check if this is an illegal parent:
(You can replicate this by running the code in the advanced example)

gantt.taskStore.getById(15)["parentId"] = 12

I would expect e.g. a "setParent" function that validates the input, but that does not exists:

gantt.taskStore.getById(15).setParent(12)

Re: Missing function to set parent on task in taskStore

Posted: Thu Jan 20, 2022 5:11 pm
by mats

This is handled in 5.0, and you will be shown a prompt to resolve the action. See attached image (5.0 is due soon). Try it in the latest nightly build too from the customer zone.


Re: Missing function to set parent on task in taskStore

Posted: Fri Jan 21, 2022 1:51 pm
by fdyrs

Ok that is perfect! But I found 1 more issue when setting parent to null:

gantt.taskStore.getById(15)["parentId"] = null;

There are already functions for setting start/end date, duration etc (see attachment), so maybe there should be a setParent or setParentId function anyway?


Re: Missing function to set parent on task in taskStore

Posted: Fri Jan 21, 2022 2:13 pm
by alex.l

Re: Missing function to set parent on task in taskStore

Posted: Fri Jan 21, 2022 5:04 pm
by fdyrs

Perfect. Thank you!