BoldDeskBoldDesk is now live on Product Hunt with a special offer: 50% off all plans. Let's grow together! Support us.
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?
Thank you in advance for your help!
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
Dear Ajithkumar !
I start from your documentation:
https://blazor.syncfusion.com/documentation/gantt-chart/entity-framework
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!
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
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 }); | |
} | |
} | |
} |
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
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.
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
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" >
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