We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use javascript to bind data source to Gantt Chart control.

Thread ID:





145160 Jun 10,2019 07:49 PM UTC Jun 11,2019 01:18 PM UTC ASP.NET Core - EJ 2 1
Tags: Gantt Chart
Asked On June 10, 2019 07:49 PM UTC

I try to use Gantt Chart. I want to bind data source to gantt chart by click a button at client side. 
How can using java script and ajax to bind gantt chart? 

I could not find any documentation on you web site.

Thank you so much

Tianyu Zhang

Jesus Arockia Sankaran S [Syncfusion]
Replied On June 11, 2019 01:18 PM UTC

Hi Tianyu, 

Thank you for contacting Syncfusion support. 
We have analyzed your requirement and prepared the simple Gantt sample, In this sample we have rendered the custom button (UPDATE DATA) and when the user click on the button, we have dynamically update the Gantt with new dataSource by using dataSource property. Please refer the below code snippet 
<button id="updateData">Update Data</button> 
var ganttChart = new ej.gantt.Gantt({ 
        dataSource: projectNewData, 
        height: '450px', 
        allowSelection: true, 
    document.getElementById('updateData').addEventListener('click', () => { 
        var GanttData = [ 
                TaskID: 1, 
                TaskName: 'Project Initiation', 
                StartDate: new Date('04/02/2019'), 
                EndDate: new Date('04/21/2019'), 
                subtasks: [ 
                    { TaskID: 2, TaskName: 'Identify Site location', StartDate: new Date('04/02/2019'), Duration: 4, Progress: 50 }, 
                    { TaskID: 3, TaskName: 'Perform Soil test', StartDate: new Date('04/02/2019'), Duration: 4, Progress: 50 }, 
                    { TaskID: 4, TaskName: 'Soil test approval', StartDate: new Date('04/02/2019'), Duration: 4, Progress: 50 } 
        setTimeout(function () { 
            ganttChart.dataSource = GanttData; // Binding new dataSource 
        }, 1000) 
Please let us know, if you require further assistance on this 
Jesus Arockia Sankaran S 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon