|
[Index.razor]
<SfTextBox @ref="Input" Placeholder='Type Task ID' Width="400px" ValueChange="ValueChange"></SfTextBox>
<SfGantt ID="GanttContainer" @ref="Gantt" CollapseAllParentTasks="true"
//…
</SfGantt>
@code{
//…
public void ValueChange(ChangedEventArgs args)
{
var data = this.Gantt.DataSource.ToList();
var selectedData = data.Where(y => y.TaskId == int.Parse(args.Value)).ToList();
var index = data.IndexOf(selectedData[0]);
this.Gantt.ExpandByID(selectedData[0].ParentId);
var parentData = data.Where(y => y.TaskId == selectedData[0].ParentId).ToList();
if(parentData.Count > 0)
{
this.expandParent(parentData);
}
this.Gantt.ExpandByID(selectedData[0].ParentId);
this.Gantt.SelectRow(index);
}
public void expandParent(List<TaskData> data)
{
this.Gantt.ExpandByID(data[0].ParentId);
var parentData = this.Gantt.DataSource.ToList().Where(y => y.TaskId == data[0].ParentId).ToList();
if (parentData.Count > 0)
{
this.expandParent(parentData);
}
}
} |
|
public void ConfigureServices(IServiceCollection services)
{
services.AddSyncfusionBlazor();
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
} |
Hi Monisha,
Hi Monisha,
Thats great to hear, we really need this feature again.
Populate a Gantt, close all its parents, select child-task by an external call (e.g. button outside the gantt).
Then the child must be selected, all it's parent must be expanded, all other parents must stay collapsed, and the selected child task must be scrolled into viewport ( autofocus).
In previous versions, autofocus was an option, now it's debricated and gone.
It is still featured on your website, but since v19.xx the Gantt-component doesn't react like that any more. Why?
https://www.syncfusion.com/aspnet-core-ui-controls/gantt-chart
Cheers,
Volker
|
Sl.No. |
Query |
Syncfusion Comments
|
|
1 |
Populate a Gantt, close all its parents, select child-task by an external call (e.g. button outside the gantt).
Then the child must be selected, all it's parent must be expanded, all other parents must stay collapsed,
|
We will consider this when implementing this support. |
|
2 |
In previous versions, autofocus was an option, now it's debricated and gone.
It is still featured on your website, but since v19.xx the Gantt-component doesn't react like that anymore. Why?
|
We do not have built-in support to Auto Scroll to tasks in latest versions.
However, we can also achieve this requirement by a work-around. We will provide you with further details within one business day(December 4, 2021). |
|
public async Task RowSelected(RowSelectEventArgs<TaskData> args)
{
System.DateTime projectstartdate = ProjectStart;
System.DateTime taskstartdate = args.Data.StartDate;
System.TimeSpan diff = taskstartdate.Subtract(projectstartdate);
var days = diff.Days;
var ele = await JSRuntime.InvokeAsync<int>("getTargetElement", days);
}
|
|
window.getTargetElement = (days) => {
var chartElement = document.getElementsByClassName("e-chart-scroll-container")[0];
var scrollLeft = 33 * days;
chartElement.scrollLeft = scrollLeft;
return scrollLeft;
};
|
Hi Monisha,
I don't want to be rude, but your website says "auto focus tasks" as a key-feature of the current version.
Have a look here:
The GIF shows exactly how it should behave:
https://www.syncfusion.com/aspnet-core-ui-controls/gantt-chart
Again to the history: up to the version V18.xx this worked wonderfully, since V19.xx the function was deleted, now "auto focus" is switched on permanently as standard for the GANNT.
But in fact this basic feature does not work since V19.x and now we are all supposed to implement this javascript work-around, in Blazor Server?
Please confirm that you are serious about this.
Cheers,
Volker