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

Enquiry about adding a checkbox to the dialog box

I want to add a checkbox to the gantt chart dialog box, which I can read in the controller to check the user ticks it or not when updating, inserting or deleting a record in the dialog box. So far everything is in the default setting, and I used the e-data-manager and the controller behind to bind the data to my database:

<e-data-managerurl="/SyncfusionGantt/Url"adaptor="UrlAdaptor"batchUrl="SyncfusionGantt/BatchUrl">e-data-manager> 

The BatchUrl in the controller is:

public class CRUD where T : class
{
public List AddedObject { get; set; }
public List ChangedObject { get; set; }
public List DeletedObject { get; set; }
public object key { get; set; }
public string action { get; set; }
public T Value { get; set; }
}


public IActionResult BatchUrl([FromBody] CRUD batchmodel)
{
//how can i get the checkbox value here? I need it because it decides how I upload the data to the database

if (batchmodel.ChangedObject != null)
{
//update to database




}
...






}



1 Reply

MS Monisha Sivanthilingam Syncfusion Team January 9, 2023 11:23 AM UTC

Hi Desmond,


Greetings from Syncfusion support.


It is possible to render a checkbox in the Gantt columns using the editType property and then get the checkbox state in the BatchUpdate method. The column will return a value of true or false based on the checkbox state, which you can use to customize your code as needed.


Index.cshtml

 

<e-gantt-column field="verified" headerText="Verified" editType="booleanedit"></e-gantt-column>

 


HomeController.cs

 

public IActionResult BatchUpdate([FromBody]CRUDModel batchmodel)

{

  if (batchmodel.Changed != null)

  {

    for (var i = 0; i < batchmodel.Changed.Count(); i++)

    {

       var value = batchmodel.Changed[i];

       GanttDataSource result = DataList.Where(or => or.taskId == value.taskId).FirstOrDefault();

       result.taskId = value.taskId;

       result.taskName = value.taskName;

       result.startDate = value.startDate;

      result.endDate = value.endDate;

       result.duration = value.duration;

       result.progress = value.progress;

       result.predecessor = value.predecessor;

       result.resources = value.resources;

       result.parentID = value.parentID;

       result.verified = value.verified;

    }

  }

 

              …

}

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/F_1798651789524864


Online Documentation: https://ej2.syncfusion.com/aspnetcore/documentation/gantt/managing-tasks/task-bar-editing#cell-edit-type-and-its-params


Regards,

Monisha.


Loader.
Up arrow icon