Gantt Chart widget events
- Last UpdatedOct 10, 2025
- 2 minute read
The Gantt Chart widget supports the following events:
On Initialize
Use scripts on the onInitialize event of a Gantt Chart widget to accomplish a specific operation after the widget is initialized but before it's rendered to the UI.
For example scripts, see timeInterval property, Examples 2 and Example 3.
On Timer Refresh
Use scripts on the onTimerRefresh event of a Gantt Chart widget to accomplish a certain operation such as updating the Gantt Chart bar data during runtime. This event is triggered based on the timer value setting. Use this together with the updateDataSegments property.
A repeated timer can be activated with enableTimerRefresh set to true and X number of seconds for timerRefreshRate in globalSetting of data property. This event is then triggered repeatedly at the end of each duration.
Note: This event is ignored when there is an active selection on the Gantt Chart segments.
For example script, see Update Data Segments.
On Action(1-3)
Use scripts for the onAction event of a Gantt Chart widget to accomplish a certain operation such as pushing the associated event data of an action 1, 2, or 3 button to its corresponding action Data property when it's clicked in the widget's details pane.
Example
The following script picks up the action data based on the clicked action button on the details pane.
var temp = control.findByXmlNode("Widget1").widgetProperties.action1Data;
if(temp !=null && temp != "")
{
try
{
var ganttData = JSON.parse(temp);
var id = ganttData.id ; // retrieve the id element of selected object
}
catch(ex)
{
}
}
On Selection Change
Use scripts for the onSelectionChange event of the Gantt Chart widget to accomplish a specific operation such as populating the selectedData property with the data associated to a new selection made on the Gantt Chart bar. The selectedData property will have a null value when a deselect action is performed.
Example
The following script retrieves the ID of a selected object.
var temp = control.findByXmlNode("Widget1").widgetProperties.selectedData;
if(temp !=null && temp != "")
{
try
{
var ganttData = JSON.parse(temp);
var bar = ganttData.bar ; // retrieve the bar information
var segment = ganttData.segment; //retrieve the segment information
}
catch(ex)
{
}
}
On Refresh
Use scripts for the onRefresh event of a Gantt Chart widget to refresh the widget. This event is triggered when the refresh property is set. You can use this with the data or updateDataSegments property.
For example scripts, see Data and Update Data Segments.