updateLink

updates the specified dependency link

void updateLink(string | number id);
idstring | numberthe task id

Example

gantt.addLink({
    id:5, 
    source:1, 
    target:2, 
    type:1
});
 
gantt.getLink(5).type = 2; //changes link's data
gantt.updateLink(5); //renders the updated link

Details

The method invokes the onAfterLinkUpdate event.

The method triggers the DataProcessor if the dataProcessor is enabled.

This method should be called after modifying the link object to update the Gantt's state, repaint related UI elements, and send the changes to the backend.

Calling this method will fire the onAfterLinkUpdate event, which may trigger additional recalculations.

If you're using the DataProcessor, invoking this method will prompt an update request to the server.

For making visual changes that don't require saving, use the refreshLink method instead. This will repaint the record in the Gantt without any extra calculations or server requests.

let selectedLink = null;
gantt.templates.link_class = function(link){
    if(link.id == selectedLink) {
        return "selected_link";
    }
};
 
gantt.attachEvent("onLinkClick", function(id,e){
    selectedLink = id;
    gantt.refreshLink(id); });
See also
Back to top