[Bug?] WBSCode is null in actionComplete event after adding task (but appears later)

Hi Syncfusion team,

I'm using @syncfusion/[email protected] and ran into an issue with WBSCode.

When I add a new task (either using the Add button on the toolbar or via addRecord()), the WBSCode is null inside the actionComplete event (when requestType === 'add').

But after the Gantt is fully rendered, the WBS code appears correctly in the UI (e.g., "1.1", "1.2").

So it seems like the WBSCode is not calculated yet at the moment actionComplete fires?

My settings:

  • enableWBS: true is enabled
  • No mapping for WBSCode in taskFields (I understand it's not required)

Example code:

actionComplete: (args) => {
  if (args.requestType === 'add') {
    console.log(args.data); // WBSCode is still null ❌
  }
}

My questions:

  • Is this expected behavior?
  • If I want to get the generated WBSCode right after adding the task, is there another event or workaround I should use?

Thanks a lot for your support!


1 Reply 1 reply marked as answer

SJ Sridharan Jayabalan Syncfusion Team July 3, 2025 12:25 PM UTC

Hi Van,

 

Greetings from Syncfusion.

 

The scenario you reported is an expected behavior of our Gantt chart. After the save action is completed, the WBS code is calculated, because there is a possibility to revert or manipulate the data while save action within the actionBegin or actionComplete events.

 

To retrieve the WBS code, we recommend using the actionComplete event. Within this event, set a flag variable (isAdd) when the requestType is "add". Then, during the requestType of "refresh", you can access the WBS code based on the flag. Refer to the code snippet and sample for your reference.

 

Code-Snippet:   

index.js:-

 

var isAdd = false;

var ganttChart = new ej.gantt.Gantt({

  actionComplete(args) {

    if (args.requestType == 'add') {

      isAdd = true;

    }

    if (isAdd && args.requestType == 'refresh') {

      isAdd = false;

      console.log('Wbs value: ' + args.rows[0].data.WBSCode);

    }

  },

});

 

 

Regards,

Sridharan


Marked as answer
Loader.
Up arrow icon