SfGantt and CustomAdaptor - Rebind Query data
Hi there,
in same cases we need to replace the query data of an existing Gantt after rendering the diagram.
e.g. (strongly simplified):

How can we totally rebind the query and refresh/redraw the gantt rather than just filtering an existing query?
Any ideas?
Cheers,
Volker
e.g. (strongly simplified):
How can we totally rebind the query and refresh/redraw the gantt rather than just filtering an existing query?
Any ideas?
Cheers,
Volker
SIGN IN To post a reply.
3 Replies
PE
Punniyamoorthi Elangovan
Syncfusion Team
October 7, 2020 05:37 PM UTC
Hi Volker,
Thank you for contacting Syncfusion support.
We have analyzed your requirement and provided screenshot. We have achieved your requirement with some work around solution. We have prepared the sample for your reference, in this sample we have maintained custom property QuerData and assigned query values to this property and filtered the record based on this query values in data manager Read method. If user dynamically updating this query values then we have called Gantt refresh method, now data manager Read method will call and we have filtered the records based on the updated query values. Please refer the below code snippet for more details
|
<button type="button" @onclick="changeQueryData">
change query
</button>
<SfGantt @ref="myGantt" ID="GanttExport" TValue="Table" HighlightWeekends="true"
>
<SfDataManager Adaptor="Adaptors.CustomAdaptor">
<CustomComponent QueryData ="@GanttQueryData"></CustomComponent>
</SfDataManager>
..//
</SfGantt>
@code {
public Query GanttQueryData { get; set; }
public SfGantt<Table> myGantt;
protected override void OnInitialized()
{
GanttQueryData = new Query().Where("Id", "greaterthan", 1);
}
private async Task changeQueryData()
{
GanttQueryData = new Query().Where("Name", "equal", "child 1");
myGantt.Refresh();
}
}
CustomComponent.razor
public Query QueryData { get; set; }
ganttcheckContext db = new ganttcheckContext();
// Performs data Read operation
public override object Read(DataManagerRequest dm, string key = null)
{
IEnumerable<Table> DataSource = db.Table;
if (this.QueryData.Queries.Where != null && this.QueryData.Queries.Where.Count > 0)
{
// Filtering
DataSource = DataOperations.PerformFiltering(DataSource, this.QueryData.Queries.Where, this.QueryData.Queries.Where[0].Operator);
}
int count = DataSource.Cast<Table>().Count();
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)Service.Table;
} |
You can find the sample for this from below link
Regards,
Punniyamoorthi
VO
Volker
April 1, 2021 07:44 AM UTC
Hi Punniyamoorthi,
your solution using .Refresh() does not work anymore in v19.1.54:
your solution using .Refresh() does not work anymore in v19.1.54:
.Refresh() is gone.
How can we manually refresh the Gantt now?
How can we manually refresh the Gantt now?
Any ideas?
Cheers,
Volker
Cheers,
Volker
PP
Pooja Priya Krishna Moorthy
Syncfusion Team
April 3, 2021 07:39 AM UTC
Hi Volker,
We are sorry for the inconvenience caused.
As we moved our Gantt component to native approach(i.e. minimal usage of Java script in the area of data operation, event handling in background), some of the methods and properties have been missed that will be include in our upcoming releases.
We logged an improvement task for this. The status can be tracked from below feedback link.
We will include this in our upcoming Volume 1 SP1 2021 release which is expected to be rolled out at the end of this month.
Until then we appreciate your patience.
Regards,
Pooja K.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
VO Volker
- Sep 28, 2020 07:52 AM UTC
- Apr 3, 2021 07:39 AM UTC