Premium support for our pure JavaScript UI components


Post 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)

Post 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.

Attachments
Screenshot 2022-01-20 at 16.11.21.png
Screenshot 2022-01-20 at 16.11.21.png (160.18 KiB) Viewed 455 times

Post 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?

Attachments
Screenshot 2022-01-21 124750.png
Screenshot 2022-01-21 124750.png (31.44 KiB) Viewed 440 times

Post by alex.l »

All the best,
Alex


Post by fdyrs »

Perfect. Thank you!


Post Reply