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
close icon

What is the correct setting for Gantt to use the BatchUpdate method?

In the attached code, the Update method is used for updating and never the BatchUpdate (so group changes are not saved). What is the correct setting?

Gantt sample


Thank you in advance for your help!



9 Replies

AG Ajithkumar Gopalakrishnan Syncfusion Team April 4, 2023 01:34 PM UTC

Hi Szoke,


Thank you for your message regarding our Gantt sample. We appreciate your interest in our product and we're here to help you with any questions you may have.

Regarding your inquiry about batch editing in the Gantt chart, we would like to inform you that at this time, the Gantt chart does not support batch editing. The sample you provided uses the Update method for updating tasks individually. While the Gantt chart does offer custom adaptors that include CRUD operations, such as insert, delete, and update, it does not currently support batch updates.

https://www.syncfusion.com/feedback/23570/provide-batch-editing-support-in-gantt-chart

To use the URL adaptor, you would need to make the necessary modifications to your code to implement the sample adaptor. Once you have made the changes, please let us know and we would be happy to provide you with further assistance.

https://blazor.syncfusion.com/documentation/data/adaptors


We hope this information helps. If you have any further questions or concerns, please don't hesitate to reach out to us.


Thank you for choosing our product, and we hope to continue serving you in the future.

Best regards,

Ajithkumar G



SZ Szoke April 4, 2023 04:36 PM UTC

Dear Ajithkumar !


I start from your documentation:

https://blazor.syncfusion.com/documentation/gantt-chart/entity-framework

ganttBatch.png

According to them, the Batchupdate method should run when changes are made, but we only run Update (1 record modified).


Thank you in advance for your help!




AG Ajithkumar Gopalakrishnan Syncfusion Team April 5, 2023 11:53 AM UTC

Hi Szoke,


We apologize for any confusion that our documentation may have caused. The BatchUpdate method is designed to validate, and update modified records with dependencies and parents. For instance, when a child record End date is changed, parent record End date will also be changed (if applicable). In this case both records are updated in bulk using this method. So both Update and BatchUpdate method is needed. 


Best regards,

Ajithkumar G



SZ Szoke replied to Ajithkumar Gopalakrishnan April 5, 2023 01:40 PM UTC

Dear Ajithkumar !


The problem is that, according to our testing, for example in the below (and attached) sample code: The Dataadapter never runs on the Batchupdate method, even though it would be needed, it only runs on the Update method!


@page "/ganttchart-features"
@using Syncfusion.Blazor.Gantt
@using Data
@using Models
@using Syncfusion.Blazor.Data
<h2>Gantt Chart</h2>
<br/>
<SfGantt Height="1000px" Width="100%" TValue="GanttAdat" ProjectStartDate="@ProjectStart" ProjectEndDate="@ProjectEnd"
LoadChildOnDemand="true" Toolbar="@(new List<string>() { "NextTimeSpan", "PrevTimeSpan", "Search", "Add", "Cancel", "Delete", "Edit", "Update", "ZoomIn","ZoomOut","ZoomToFit" })">
<SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor" ></SfDataManager>
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Dependency="Predecessor" ParentID="ParentId">
</GanttTaskFields>
<GanttEditSettings AllowEditing="true" AllowTaskbarEditing="true" AllowAdding="true" AllowDeleting="true" ShowDeleteConfirmDialog="true"></GanttEditSettings>
<GanttTimelineSettings TimelineUnitSize="@DefaultUnitWidth">
<GanttTopTierSettings Unit="@TopTierUnit" Count="@TopTierCount" Format="@TopTierFormat"></GanttTopTierSettings>
<GanttBottomTierSettings Count="@BottomTierCount" Unit="@BottomTierUnit" Format="@BottomTierFormat"></GanttBottomTierSettings>
</GanttTimelineSettings>
</SfGantt>
<br/>
<div>
<h3>Selected Features:</h3>
<ul class="ulstyle">
<li class="list"> Zooming</li>
<li class="list"> Editing</li>
<li class="list"> Filtering</li>
<li class="list"> Timeline</li>
<li class="list"> Theme - Fluent</li>
</ul>
</div>
<br/>
<style>
.ulstyle {
margin: 0px;
padding-left: 20px;
display: inline-block;
}
.list {
float: left;
line-height: 20px;
margin: 10px;
min-width: 200px;
}
</style>
@code{
public DateTime ProjectStart = new DateTime(2023, 4, 1);
public DateTime ProjectEnd = new DateTime(2023, 12, 4);
public int DefaultUnitWidth = 33;
public int TopTierCount = 1;
public int BottomTierCount = 1;
TimelineViewMode TopTierUnit = TimelineViewMode.Week;
TimelineViewMode BottomTierUnit = TimelineViewMode.Day;
string TopTierFormat = "MMM dd, yyyy";
string BottomTierFormat = "";
public string[] Searchfields = new string[] { "TaskId", "TaskName", "StartDate", "EndDate", "Duration", "Progress", "Predecessor" };
public class CustomAdaptor : DataAdaptor
{
TesztContext db = new TesztContext();
public override object Read(DataManagerRequest dm, string key = null)
{
IEnumerable<GanttAdat> DataSource = db.GanttAdat.Where(x => x.FejCsatolo == 37);
int count = DataSource.Cast<GanttAdat>().Count();
return dm.RequiresCounts ? new DataResult()
{ Result = DataSource, Count = count } : (object)DataSource;
}
public override object Insert(DataManager dataManager, object value, string key)
{
using (var db = new TesztContext())
{
var sor= (GanttAdat)value;
sor.FejCsatolo = 37;
//rec.TaskName = rec.TaskName + "_alá";
db.GanttAdat.Add(sor);
db.SaveChanges();
}
return value;
}
public override object Update(DataManager dataManager, object value, string keyField, string key)
{
var Data = (value as GanttAdat);
return value;
}
public override object BatchUpdate(DataManager dm, object changedRecords, object addedRecords, object deletedRecords, string keyField, string key, int? dropIndex)
{
List<GanttAdat> addRecord = addedRecords as List<GanttAdat>;
List<GanttAdat> changed = changedRecords as List<GanttAdat>;
List<GanttAdat> deleteRecord = deletedRecords as List<GanttAdat>;
if (changed != null)
{
for (var i = 0; i < changed.Count(); i++)
{
var value = changed[i];
}
}
if (deleteRecord != null)
{
for (var i = 0; i < deleteRecord.Count(); i++)
{
var value = deleteRecord[i];
}
}
if (addRecord != null)
{
for (var i = 0; i < addRecord.Count(); i++)
{
var value = addRecord[i];
}
}
return (new { addedRecords = addRecord, changedRecords = changed, deletedRecords = deleteRecord });
}
}
}



AG Ajithkumar Gopalakrishnan Syncfusion Team April 6, 2023 03:20 PM UTC

Hi Szoke,


Regarding your concern about the Batchupdate method not running the Custom adapter, we would like to clarify that our Gantt control does not support batch updates. Therefore, the Custom adapter will only run on the Update method, which is built to handle the return of edited records as well as the updating of internally dependent records and edited records.


We understand that this may not have been the solution you were expecting, but we hope that this information helps to clarify the situation. If you have any further questions or concerns, please do not hesitate to reach out to us.



Best regards,

Ajithkumar G



SZ Szoke April 6, 2023 04:23 PM UTC

Dear Ajithkumar !


We find that if we modify a Task, it runs the Update method. But other (child) task changes resulting from the previous task modification do not generate another Update event in the Dataadapter-> we can save only the very first Task change to the database, not the others.



AG Ajithkumar Gopalakrishnan Syncfusion Team April 11, 2023 10:17 AM UTC

Hi Szoke,

We have considered the reported issue “Batch update method not working in Custom Adaptor” as a bug. You can track the progress of the resolution by visiting the feedback link provided below:

Feedback link https://www.syncfusion.com/feedback/42804/batch-update-method-not-working-in-custom-adaptor

You can track the progress of the resolution by visiting the feedback link that you provided. Our development team is currently working on this issue, and we aim to provide a solution by the first week of May.

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

Regards,

Ajithkumar G



TR Tim Rawles May 8, 2023 03:17 PM UTC

Is there any update on this please? I cannot follow the link (Access Denied).

I can only get the Batch Update to fire if I add BatchUrl="anyvalue" on the SfDataManager:

<SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor" BatchUrl="xx" >



AG Ajithkumar Gopalakrishnan Syncfusion Team May 9, 2023 02:24 PM UTC

Hi Tim,

Thank you for your patience.

We are glad to announce that fix for the issue “Batch update method not working in Custom Adaptor 
has been rolled out in our patch release (v21.2.4). So please upgrade to our latest version to resolve the problem.

Release Notes: https://blazor.syncfusion.com/documentation/release-notes/21.2.4?type=all#ganttchart

The batch update method using the sample is attached below. Then the feedback link is now accessible.

Please contact us if you require any further assistance.


Regards,

Ajithkumar G



Attachment: BatchUpdateSample_6357d3bd.zip

Loader.
Live Chat Icon For mobile
Up arrow icon