RadiantQ jQuery Gantt Package
How to listen the Activity CollectionChanges in GanttControl?
Previous Topic  Next Topic 

Sometime we might want to listen the activity collection changes to, for example, subscribe to the property change event for newly added tasks at runtime. Here is the code that shows how to do that.


ganttControl = $gantt_container.data("GanttControl");

var activityViews = ganttControl.ActivityViews;

//To listen to the task collection changes.

activityViews.CollectionChanged.subscribe(function (event, ui) {

    if (event.type === "insert") {

        //task is the newly added task

        var task = ui.items[0].Activity.DataSource;

        task.PropertyChanged.subscribe(PropertychangeNotifier);


    }

    else {

        //task is the removed task

        var task = ui.items[0].Activity.DataSource;

        task.PropertyChanged.unsubscribe(PropertychangeNotifier);

    }

});


To know more about PropertyChanged event take look at this topic.






� RadiantQ 2022. All Rights Reserved.