Class SfGantt<TValue>
Blazor Gantt chart is a project management tool which is used for scheduling and managing projects. It allows us to manage tasks, task relationships, and resources in a project.
Implements
Inherited Members
Namespace: Syncfusion.Blazor.Gantt
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfGantt<TValue> : SfDataBoundComponent, IGantt
Type Parameters
Name | Description |
---|---|
TValue | The second generic type parameter. |
Remarks
TValue
is inferred from value of DataSource
property if it is bounded with IEnumerable.
If data is consumed using SfDataManager
then TValue must be assigned explicitly.
Constructors
SfGantt()
Declaration
public SfGantt()
Properties
AddDialogFields
Gets or sets an instance of GanttAddDialogField collection which provides information on tab sections within the dialog for adding new records and the column fields of the grid within each tab section.
Declaration
public List<GanttAddDialogField> AddDialogFields { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttAddDialogField> | A List instance of GanttAddDialogField. |
Remarks
The tabs that contain the editors for columns include: General:A tab for entering values for the columns of a new gantt record. Dependency: A tab for editing dependencies. Resources: A tab for editing resources. Notes: A tab for editing notes.
Examples
<SfGantt DataSource="@TaskCollection" AddDialogFields=@addDialogFields Toolbar="@(new List<string>(){ "Add"})">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" Dependency="Predecessor" ParentID="ParentId">
</GanttTaskFields>
<GanttEditSettings AllowAdding="true"></GanttEditSettings>
</SfGantt>
@code{
private List<TaskData> TaskCollection { get; set; }
private List<GanttAddDialogField> addDialogFields { get; set; } = new List<GanttAddDialogField>()
{
new GanttAddDialogField(){ Fields = new string[]{"TaskId","TaskName","EndDate","Duration"}, HeaderText = "General" , Type = GanttDialogFieldType.General},
new GanttAddDialogField(){ Fields = new string[]{"Dependency"}, HeaderText="Predecessor" ,Type = GanttDialogFieldType.Dependency }
};
}
AllowExcelExport
Gets or sets a value indicating whether to allow exporting Gantt data to excel and csv.
Declaration
public bool AllowExcelExport { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Exporting can be customized using ExcelExportProperties type parameter of ExportToCsvAsync() method.
AllowFiltering
Gets or sets a value indicating whether filtering is allowed.
Declaration
public bool AllowFiltering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can cancel or customize the filtering action through OnActionBegin event handler.
AllowMultiSorting
Gets or sets whether to allow user to sort multiple column in Gantt.
Declaration
public bool AllowMultiSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
AllowPdfExport
Gets or sets a value indicating whether PDF export is allowed or not in gantt chart.
Declaration
public bool AllowPdfExport { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Determines whether users are allowed to export data to PDF format. Set this property to true to enable PDF export; otherwise, default value is false.
Examples
<SfGantt DataSource="@TaskCollection" AllowPdfExport="true" Toolbar="@(new List<string>(){"PdfExport"})">
</SfGantt>
AllowReordering
Gets or sets a value indicating whether reordering is allowed.
Declaration
public bool AllowReordering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Reordering can be done by drag and drop of a particular column from one index to another index. You can cancel or customize the column reordering action through OnActionBegin event handler.
AllowResizing
Gets or sets whether to allow resizing of Gantt columns.
Declaration
public bool AllowResizing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can cancel or customize the resizing action through ColumnResizeStart event handler.
AllowRowDragAndDrop
Gets or sets whether to allow row reordering in Gantt.
Declaration
public bool AllowRowDragAndDrop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can cancel or customize the row reorder action through OnRowDragStart event handler.
AllowSelection
Gets or sets whether to allow row and cell selection in Gantt.
Declaration
public bool AllowSelection { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
To perform the multi-selection, hold CTRL key and click the desired rows/cells. To select range of rows/cells, hold SHIFT key and click the rows/cells.The default value is false. You can cancel or customize the selection action through RowSelecting event handler.
AllowSorting
Gets or sets whether to allow sorting of records when column header is clicked.
Declaration
public bool AllowSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can cancel or customize the sorting action through OnActionBegin event handler.
AllowUnscheduledTasks
Gets or sets whether to allow rendering of unscheduled tasks in Gantt.
Declaration
public bool AllowUnscheduledTasks { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can create or update the tasks with anyone of start date, end date, and duration values or none. You can enable or disable unscheduled tasks in Gantt chart by setting the AllowUnscheduledTasks property.
AutoCalculateDateScheduling
Gets or sets whether to auto calculate start and end-date by using the cases mentioned in this UG.
Declaration
public bool AutoCalculateDateScheduling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Disable the scheduling date validation, it will not change the dates value available in the data source. Also, it will improve the load time performance for the valid data source.
Examples
<SfGantt DataSource="@TaskCollection" AutoCalculateDateScheduling="false">
</SfGantt>
BaselineColor
Gets or sets the background color for baseline taskbar.
Declaration
public string BaselineColor { get; set; }
Property Value
Type | Description |
---|---|
System.String | The background color can be specified as a color name, such as "Orange", or as its hexadecimal value, such as "#FFA500".. |
ChildContent
Gets or sets the child content of the component.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment | The child content of the component. |
Remarks
This property can be used to define custom content to be rendered inside the component.
CollapseAllParentTasks
Gets or sets whether to render root tasks in collapsed state at initial rendering of Gantt Chart.
Declaration
public bool CollapseAllParentTasks { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can use Syncfusion.Blazor.Gantt.SfGantt.CollapseAllAsync method for dynamic collapsing of all parent tasks.
ColumnChooserSettings
Gets or sets an instance ColumnChooserSettings to configure the column chooser setting.
Declaration
public GanttColumnChooserSettings ColumnChooserSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttColumnChooserSettings | An instance of ColumnChooserSettings. |
Remarks
The Column Chooser settings allows developers to specify which columns should be displayed in the Gantt chart and in what order. The LabelSettings class provides properties to customize the column chooser settings.
ColumnMenuItems
Gets or Sets bulit-in menu items of Gantt columns.
Declaration
public string[] ColumnMenuItems { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | Column menu items, for example ColumnMenuItems = "@(new string[] { "AutoFillColumns","AutoFitThisColumn"})". The available built-in Column menu items are,
|
Remarks
Displays the column menu items when clicking the menu icon on column headers. ShowColumnMenu should be enabled.
Examples
<SfGantt DataSource = "@TaskCollection" ShowColumnMenu="true" AllowSorting="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private List<TaskData> TaskCollection { get; set; }
private string[] columnMenuItems = new string[] { "AutoFitAll", "AutoFit", "SortAscending" };
}
Columns
Gets or sets an instance of GanttColumn collection which provides details of grid's columns in Gantt Chart.
Declaration
public List<GanttColumn> Columns { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttColumn> | A List instance of GanttColumn. |
Remarks
The columns in the Gantt Chart are used to display the values of the fields from the records of the bound data source.If this property is not set, then the columns are automatically populated based on GanttTaskFields property.
Examples
<SfGantt DataSource="@TaskCollection" Columns=columns>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private List<TaskData> TaskCollection { get; set; }
private List<GanttColumn> columns { get; set; } = new List<GanttColumn>()
{
new GanttColumn() { Field = "TaskId", HeaderText = "ID", Width = "150" },
new GanttColumn() { Field = "TaskName", HeaderText = "Task Name", Width = "300" },
new GanttColumn() { Field = "Duration", HeaderText = "Duration", Width = "200" }
};
}
ConnectorLineBackground
Gets or sets the background color of the connector line in Gantt chart.
Declaration
public string ConnectorLineBackground { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value which represents the color in CSS format, for example "#ff00ff".The default value is "transparent". |
Remarks
The connector lines are used to represent the dependency relationship between tasks in Gantt chart.
Examples
<SfGantt DataSource="@TaskCollection" ConnectorLineBackground="Red">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
ConnectorLineWidth
Gets or sets the width of the connector line.
Declaration
public int ConnectorLineWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The width is specified in pixels. The default connector line width is 1. This property is used to determine the width of the line that connects tasks in a project. |
ContextMenuItems
Gets or sets both built-in and custom context menu items.
Declaration
public object ContextMenuItems { get; set; }
Property Value
Type | Description |
---|---|
System.Object | A list of built-in context menu items names or instance of ContextMenuItemModel for custom items. |
Remarks
The available built-in items are,
- AutoFitAllAuto fit the size of all columns
- AutoFitAuto fit the current column
- SortAscendingSort the current column in ascending order
- SortDescendingSort the current column in descending order
- TaskInformationDisplays the current task.
- SaveSaves the edited Task
- CancelCancels the edited Task
- DeleteTaskDeletes the current Task
- AddAdds a new row to the Gantt
- ConvertConvert Current Task to Milestone or vice-versa
- IndentIndent the selected record to one level
- OutdentOutdent the selected record to one level
- DeleteDependencyDeletes the current dependency task link.
Examples
<SfGantt @ref="Gantt" DataSource="@TaskCollection" ContextMenuItems=contextMenuItems EnableContextMenu="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress"
Dependency="Predecessor" ParentID="ParentId"></GanttTaskFields>
<GanttEditSettings AllowAdding = "true"></GanttEditSettings>
<GanttEvents ContextMenuItemClicked = "ContextMenuItemClickedHandler" TValue="TaskData"></GanttEvents>
</SfGantt>
@code{
private SfGantt<TaskData> Gantt;
private object contextMenuItems = new List<object> { "Add", "TaskInformation", new Syncfusion.Blazor.Grids.ContextMenuItemModel { Text = "Refresh", Target = ".e-content", Id = "refresh" } };
private List<TaskData> TaskCollection { get; set; }
private async Task ContextMenuItemClickedHandler(ContextMenuClickEventArgs<TaskData> args)
{
if (args.Item.Id == "refresh")
{
await Gantt.RefreshAsync();
}
}
}
CopyHierarchyMode
Gets or sets the mode for copying the hierarchy of the selected data in the tree grid rows.
Declaration
public CopyHierarchyType CopyHierarchyMode { get; set; }
Property Value
Type | Description |
---|---|
CopyHierarchyType | One of the CopyHierarchyType enumeration that specifies how the data is copies to clipboard. The default mode is Syncfusion.Blazor.TreeGrid.CopyHierarchyType.Parent. |
Remarks
This property determines the way in which the hierarchy of the selected data in the tree grid should be copied. The available built-in items are,
Parent
: Copy the selected data with parent record.
Child
: Copy the selected data with child record.
Both
: Copy the selected data with both parent and child record.
None
: Copy only the selected record.
CriticalSettings
Gets or sets an instance of CriticalSettings to configure the critical tasks behavior in Gantt.
Declaration
public GanttCriticalPathSettings CriticalSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttCriticalPathSettings | An instance of CriticalSettings. |
Remarks
Provides options to customize the critical path behavior.
Examples
<SfGantt @ref = "Gantt" DataSource="@TaskCollection">
<GanttCriticalPathSettings SlackValue="1">
</GanttCriticalPathSettings>
</SfGantt>
CurrentViewData
Declaration
public IEnumerable<object> CurrentViewData { get; set; }
Property Value
Type |
---|
System.Collections.Generic.IEnumerable<System.Object> |
CustomZoomingLevels
Gets or sets an instance of CustomZoomingLevels to configure zooming levels in the Gantt chart..
Declaration
public GanttZoomTimelineSettings[] CustomZoomingLevels { get; set; }
Property Value
Type | Description |
---|---|
GanttZoomTimelineSettings[] | An instance of CustomZoomingLevels. |
Remarks
The CustomZoomingLevels class provides the various properties to customize the zooming level.
Examples
<SfGantt @ref="Gantt" DataSource="@TaskCollection" CustomZoomingLevels=zoomingLevel Toolbar="@(new List<string>() { "ZoomIn", "ZoomOut", "ZoomToFit" })" Height="450px" Width="700px">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId" Dependency="Predecessor">
</GanttTaskFields>
<GanttLabelSettings LeftLabel = "TaskName" TValue="TaskData"></GanttLabelSettings>
</SfGantt>
private GanttZoomTimelineSettings[] zoomingLevel = new GanttZoomTimelineSettings[]
{
new GanttZoomTimelineSettings
{
TopTier = new GanttTopTierSettings { Unit = TimelineViewMode.Week, Format = "MMM dd,yyyy", Count = 1 },
BottomTier = new GanttBottomTierSettings { Unit = TimelineViewMode.Day, Format = "dd", Count = 1 },
TimelineUnitSize = 99, TimelineViewMode = TimelineViewMode.Week, WeekStartDay = 0, UpdateTimescaleView = true,
WeekendBackground = null, ShowTooltip = true, Level = 0
},
new GanttZoomTimelineSettings
{
TopTier = new GanttTopTierSettings { Unit = TimelineViewMode.Day, Format = "MMM dd yyyy", Count = 1 },
BottomTier = new GanttBottomTierSettings { Unit = TimelineViewMode.Hour, Format = "hh tt", Count = 12 },
TimelineUnitSize = 66,
TimelineViewMode = TimelineViewMode.Day,
WeekStartDay = 0,
UpdateTimescaleView = true,
WeekendBackground = null,
ShowTooltip = true,
Level = 1
},
new GanttZoomTimelineSettings
{
TopTier = new GanttTopTierSettings { Unit = TimelineViewMode.Day, Format = "MMM dd yyyy", Count = 1 },
BottomTier = new GanttBottomTierSettings { Unit = TimelineViewMode.Hour, Format = "hh tt", Count = 12 },
TimelineUnitSize = 99,
TimelineViewMode = TimelineViewMode.Day,
WeekStartDay = 0,
UpdateTimescaleView = true,
WeekendBackground = null,
ShowTooltip = true,
Level = 2
},
};
private SfGantt<TaskData> Gantt;
private List<TaskData> TaskCollection { get; set; }
DataSource
Gets or sets the data source for rendering gantt rows.
Declaration
public IEnumerable<TValue> DataSource { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TValue> | The data source value can be of any type that implements IEnumerable. |
Remarks
To consume data from remote service or custom adaptor, SfDataManager component has to be used.
DataSourceChanged
An event that is raised when data source is updated in Gantt Chart.
Declaration
public EventCallback<IEnumerable<TValue>> DataSourceChanged { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Collections.Generic.IEnumerable<TValue>> | An event callback function. |
Remarks
This event handler receives a System.Collections.Generic.IEnumerable<> object which provides updated data.
Examples
<SfTreeGrid>
<TreeGridEvents DataSourceChanged="DataUpdateHandler" TValue="BusinessObject"></TreeGridEvents>
</SfTreeGrid>
@code {
public void DataUpdateHandler(IEnumerable<TValue> args)
{
}
}
DateFormat
Gets or sets the date format used to display dates in the Gantt Chart.
Declaration
public string DateFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String | This property should be set to a string that represents a valid date format. Examples of valid Date format "MM/dd/YYYY". The default format is based on the culture. |
DayWorkingTime
Gets or sets an instance of GanttDayWorkingTime which represents the working time for a project.
Declaration
public List<GanttDayWorkingTime> DayWorkingTime { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttDayWorkingTime> | A List instance of GanttDayWorkingTime. |
Remarks
The working time is used to calculate the duration of tasks and the completion of the project. GanttDayWorkingTime provides various properties to customize the working time. The default day working time from 8.00 To 17.00.
Examples
<SfGantt DataSource="@TaskCollection" DayWorkingTime=ganttDayWorkingTimes>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private List<GanttDayWorkingTime> ganttDayWorkingTimes = new List<GanttDayWorkingTime>()
{
new GanttDayWorkingTime(){From= 9, To= 13},
new GanttDayWorkingTime(){From =14, To= 20}
};
private List<TaskData> TaskCollection { get; set; }
}
DependencyTypes
Gets or sets the dependency types in Gantt Chart.
Declaration
public List<DependencyType> DependencyTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<DependencyType> | A List instance of DependencyType.The default value is a list containing DependencyType.FS, DependencyType.SS, DependencyType.FF, and DependencyType.SF. |
Remarks
Only the dependency types specified in the list are allowed for mapping relationships between multiple tasks in the Gantt chart. The type specified in the first index of the DependencyTypes
property will be the default type.
Examples
<SfGantt DataSource="@TaskCollection" DependencyTypes="@(new List<DependencyType>() { DependencyType.FS })" >
</SfGantt>
DisableHtmlEncode
Gets or sets whether to encode HTML of the header and content cells.
Declaration
public bool DisableHtmlEncode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If 'DisableHtmlEncode' is set to false, it encodes the HTML of the header and content cells.
DurationUnit
Gets or sets the unit for duration field in the Gantt chart.
Declaration
public DurationUnit DurationUnit { get; set; }
Property Value
Type | Description |
---|---|
DurationUnit | The default value is of type DurationUnit and represents the unit for duration field in the Gantt chart. The available duration units are, |
Remarks
Used to map duration unit of all tasks from data source.
Examples
<SfGantt DurationUnit="DurationUnit.Day">
</SfGantt>
EditDialogFields
Gets or sets an instance of GanttEditDialogField collection which provides information on tab sections within the dialog for editing a records and the column fields of the grid within each tab section.
Declaration
public List<GanttEditDialogField> EditDialogFields { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttEditDialogField> | A List instance of GanttEditDialogField. |
Remarks
The tabs that contain the editors for columns include: General:A tab for entering values for the columns of a new gantt record. Dependency: A tab for editing dependencies. Resources: A tab for editing resources. Notes: A tab for editing notes.
Examples
<SfGantt DataSource="@TaskCollection" EditDialogFields=@editDialogFields Toolbar="@(new List<string>(){ "Edit"})">
<GanttTaskFields Id="TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" Dependency="Predecessor" ParentID="ParentId">
</GanttTaskFields>
<GanttEditSettings AllowEditing="true"></GanttEditSettings>
</SfGantt>
@code{
private List<TaskData> TaskCollection { get; set; }
private List<GanttEditDialogField> editDialogFields { get; set; } = new List<GanttEditDialogField>()
{
new GanttEditDialogField(){ Fields = new string[]{"TaskId","TaskName","EndDate","Duration"}, HeaderText = "General" , Type = GanttDialogFieldType.General},
new GanttEditDialogField(){ Fields = new string[]{"Dependency"}, HeaderText="Predecessor" ,Type = GanttDialogFieldType.Dependency }
};
}
EditSettings
Gets or sets an instance of GanttEditSettings which configures CRUD action behavior in Gannt Chart.
Declaration
public GanttEditSettings EditSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttEditSettings | An instance of GanttEditSettings. |
Remarks
GanttEditSettings class provides various properties to customize editing operations.
Examples
<SfGantt DataSource = "@TaskCollection" EditSettings=ganttEditSettings Toolbar = "@(new List<string>() { "Add", "Delete", "Edit"})">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private List<TaskData> TaskCollection { get; set; }
private GanttEditSettings ganttEditSettings { get; set; } = new GanttEditSettings()
{
AllowAdding = true,AllowEditing= true, AllowDeleting= true
};
}
EnableAdaptiveUI
Gets or sets whether to enable the adaptive user interface (UI) that adjusts the Gantt DOM elements with different alignment and layout, improving user interaction on mobile and tablet devices.
Declaration
public bool EnableAdaptiveUI { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enabling the adaptive UI allows users to interact seamlessly with the elements of the Gantt chart on mobile and tablet devices. The mobile and tablet adaptive layouts are enabled for various actions, including filtering, add dialog, edit dialog, and viewing dependency details in the grid view of task information dialogs.
EnableColumnVirtualization
Gets or sets whether to enable the column virtualization for the Gantt.
Declaration
public bool EnableColumnVirtualization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If 'EnableColumnVirtualization' is set to true, then the Gantt will Initially, render only the columns that are in the current viewport and also load projects with a large number of columns with better performance. Subsequent columns are loaded on horizontal scrolling. This helps to load a large dataset with a large number of columns in the Gantt.
Examples
<SfGantt DataSource = "@TaskCollection" EnableColumnVirtualization="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
EnableContextMenu
Gets or sets whether to enable all built-in context menu Items.
Declaration
public bool EnableContextMenu { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
You can customize the context menu actions through ContextMenuOpen and ContextMenuItemClicked event handlers.
Examples
<SfGantt DataSource = "@TaskCollection" EnableContextMenu="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
EnableCriticalPath
Gets or sets a value indicating whether the critical task and the chain of linked tasks in the Gantt Chart should be highlighted.
Declaration
public bool EnableCriticalPath { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The critical path in a project is indicated by a single task or a series of tasks in a project. Critical path is the longest sequence of activities that must be finished on time to complete the entire project
EnablePersistence
Gets or sets whether to persist the Gantt state while refreshing the web page.
Declaration
public bool EnablePersistence { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Gantt state is saved in the browser local storage by which the properties of the Gantt will be retained even after refreshing the page.
Examples
<SfGantt DataSource = "@TaskCollection" EnablePersistence="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
EnablePredecessorValidation
Gets or sets whether to validate the predecessor.
Declaration
public bool EnablePredecessorValidation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Enabling predecessor validation ensures that the relationships between tasks are properly maintained. You can perform custom validations through OnActionBegin event handler.
EnableRowHover
Gets or sets whether to enable hovering effect on Gantt chart rows while mouse over it.
Declaration
public bool EnableRowHover { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
While hovering on the row, the background color of the row element changes.
EnableRowVirtualization
Gets or sets a value indicating whether to enable row virtualization on the grid. When enabled, only the rows visible within the viewport are rendered and on vertical scrolling, subsequent rows are loaded.
Declaration
public bool EnableRowVirtualization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If EnableRowVirtualization
set to true, then the Gantt loads only the rows that are visible within the viewport, which improves performance for large datasets.
Examples
<SfGantt DataSource = "@TaskCollection" EnableRowVirtualization="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
EnableRtl
Gets or sets whether to render Gantt Chart component in right to left direction, and fields are accessible in right to left
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property is used to enable or disable the RTL layout for the Gantt chart.
EnableTimelineVirtualization
Gets or sets a value indicating whether to enable timeline virtualization on the chart side. When enabled, only the timeline cells in the current viewport are rendered and subsequent timeline cells are loaded dynamically on horizontal scrolling.
Declaration
public bool EnableTimelineVirtualization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If EnableTimelineVirtualization
set to true, then the Gantt loads only the timeline cells thrice the width of the Gantt element, which improves performance for large time span.
Examples
<SfGantt DataSource = "@TaskCollection" EnableTimelineVirtualization ="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
EnableVirtualization
Gets or sets whether to render only the rows visible within the view-port and render timeline cells twice the width of the gantt element. Gantt load subsequent rows on vertical scrolling and timeline cells on horizontal scrolling.
Declaration
public bool EnableVirtualization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If 'EnableVirtualization' set to true, then the Gantt will render only the rows visible within the view-port and also loads project with large time span with better performance. Subsequent rows and timeline cells are loaded on vertical scrolling and horizontal scrolling respectively.This helps to load large dataset with large timespan in Gantt.
Examples
<SfGantt DataSource = "@TaskCollection" EnableVirtualization="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
EventMarkers
Gets or sets a collection of GanttEventMarker instances that configure the events displayed in the Gantt Chart.
Declaration
public List<GanttEventMarker> EventMarkers { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttEventMarker> | A List instance of GanttEventMarker. |
Remarks
The GanttEventMarker class provides various properties to customize event markers in the Gantt Chart.
Examples
<SfGantt DataSource="@TaskCollection" EventMarkers=events>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
public List<TaskData> TaskCollection { get; set; }
private List<GanttEventMarker> events { get; set; } = new List<GanttEventMarker>()
{
new GanttEventMarker(){ Day = new DateTime(2019, 04, 11), Label = "Project approval and kick-off", CssClass = "e-custom-event-marker" }
};
}
FilterSettings
Gets or sets an instance of the GanttFilterSettings class, which is used to configure the filtering action in the Gantt Chart.
Declaration
public GanttFilterSettings FilterSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttFilterSettings | An instance of GanttFilterSettings. |
Remarks
The FilterSettings enum class provides various options to customize the filter action.
Examples
<SfGantt DataSource="@TaskCollection" AllowFiltering="true" FilterSettings=ganttFilterSettings>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private GanttFilterSettings ganttFilterSettings = new GanttFilterSettings()
{
HierarchyMode = FilterHierarchyMode.None
}
public List<TaskData> TaskCollection { get; set; }
}
FlatData
Declaration
public IEnumerable<object> FlatData { get; set; }
Property Value
Type |
---|
System.Collections.Generic.IEnumerable<System.Object> |
GridLines
Defines how to show borders of row and cells in Gantt Chart.
Declaration
public GridLine GridLines { get; set; }
Property Value
Type | Description |
---|---|
GridLine | One of the GridLine enumeration that specifies whether to render horizontal and vertical border lines. The default value is Syncfusion.Blazor.Grids.GridLine.Horizontal. |
Remarks
The availble grid lines are,
- BothDisplays both the horizontal and vertical grid lines.
- NoneNo grid lines are displayed.
- HorizontalDisplays the horizontal grid lines only.
- VerticalDisplays grid lines based on the theme.
Examples
<SfGantt DataSource="@TaskCollection" GridLines="GridLine.Horizontal">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
<GanttSelectionSettings Mode = "Syncfusion.Blazor.Grids.SelectionMode.Cell" ></ GanttSelectionSettings >
</ SfGantt >
Height
Gets or sets the height of the Gantt component container.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | The height of the Gantt chart should be set to a specific pixel or percentage or auto, for example "500px". The default value is "auto". |
HighlightWeekends
Gets or sets whether to highlight all the weekend days. It is applicable only on day timeline mode.
Declaration
public bool HighlightWeekends { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
<SfGantt DataSource="@TaskCollection" HighlightWeekends="true">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
<GanttSelectionSettings Mode = "Syncfusion.Blazor.Grids.SelectionMode.Cell" ></ GanttSelectionSettings >
</ SfGantt >
Holidays
Gets or sets an instance of GanttHoliday collection in the Gantt chart to display holidays.
Declaration
public List<GanttHoliday> Holidays { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttHoliday> | A List instance of GanttHoliday objects. |
Remarks
The GanttHoliday class provides various properties to customize the appearance of holidays in the Gantt chart.
Examples
<SfGantt DataSource="@TaskCollection" Holidays=holidays >
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
@code{
private List<GanttHoliday> holidays = new List<GanttHoliday>()
{
new GanttHoliday(){ From = new DateTime(2022, 04, 11), To = new DateTime(2022, 04, 12), Label = "Public holidays"},
};
public List<TaskData> TaskCollection { get; set; }
}
ID
Gets or sets the Gantt DOM element's Id.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | HtmlElement ID, for example "GanttEditing". |
Examples
<SfGantt ID="GanttEditing" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
IncludeWeekend
Gets or sets whether to consider weekend days as working day or not.
Declaration
public bool IncludeWeekend { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
<SfGantt DataSource="@TaskCollection" IncludeWeekend=true>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
KeySettings
Gets or Sets an instance of KeySettings to configure the hot keys of Gantt Chart.
Declaration
public GanttKeySettings KeySettings { get; set; }
Property Value
Type | Description |
---|---|
GanttKeySettings | An instance of KeySettings |
Remarks
KeySettings class provides the properties to customize the hot keys.
Examples
<SfGantt DataSource="@TaskCollection" KeySettings=ganttkeySettings>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
<GanttSelectionSettings Mode = "Syncfusion.Blazor.Grids.SelectionMode.Cell" ></ GanttSelectionSettings >
</ SfGantt >
@code{
private GanttKeySettings ganttkeySettings = new GanttKeySettings()
{
MoveLeftCell = "Shift+LeftArrow"
};
public List<TaskData> TaskCollection { get; set; }
}
LabelSettings
Gets or sets an instance of LabelSettings to configure the labels in Gantt Chart.
Declaration
public GanttLabelSettings<TValue> LabelSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttLabelSettings<TValue> | An instance of LabelSettings. |
Remarks
The LabelSettings class provides the various properties of the gantt label setting.
LoadChildOnDemand
Gets or sets whether to load child records on demand in remote data binding. Initially, parent records are rendered in a collapsed state.
Declaration
public bool LoadChildOnDemand { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Loading child records on demand can improve the performance of data-bound controls with a large number of records. Child records are only loaded when they are requested, rather than loading all child records at once. This property is not applicable for local data binding.
Locale
Gets or sets the culture name for displaying localized content in Gantt Chart.
Declaration
public string Locale { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value is "en-US" |
OverscanCount
Gets or sets the number of additional items to be rendered in the DOM before and after the visible items (based on PageSize) when virtual scrolling is enabled in gantt.
Declaration
public int OverscanCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of additional items to pre-render before and after the visible items (based on |
Remarks
Adjusting this property can enhance scrolling performance and optimize rendering, especially for large datasets in a virtualized Gantt Chart. By pre-rendering a buffer of extra items that are not yet visible, the component minimizes the need for frequent re-rendering while scrolling. This optimization results in a smoother and more responsive user experience.
PageSize
Gets or sets the number of items displayed per page when virtual scrolling feature is enabled..
Declaration
public Nullable<int> PageSize { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | An integer value representing the number of items displayed per page. |
Remarks
This property specifies the number of visible items on each page, ensuring a clear and organized view of the Gantt Chart. Without this setting, twice the number of records based on the gantt content height are displayed per page.
ProjectEndDate
Gets or sets the end date of the project.
Declaration
public Nullable<DateTime> ProjectEndDate { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> | The date value of the project end date. The default value is null. |
ProjectStartDate
Gets or sets the start date of the project in Gantt chart.
Declaration
public Nullable<DateTime> ProjectStartDate { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> | Project start date value in DateTime. The default value is null. |
Examples
<SfGantt DataSource="@TaskCollection" ProjectStartDate="@ProjectStart">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
@code{
private DateTime? ProjectStart = new DateTime(2022, 01, 01);
public List<TaskData> TaskCollection { get; set; }
}
Query
Gets or sets an instance of Query which process the data based on query provided.
Declaration
public Query Query { get; set; }
Property Value
Type | Description |
---|---|
Query | An instance of Query. |
Remarks
The Query
property is used to retrieve data from a data source and display it in the Gantt chart.
Query class provides various options for doing data operations in Gantt Chart.
Examples
<SfGantt DataSource="@TaskCollection" Query=query>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
@code{
private Syncfusion.Blazor.Data.Query query = new Syncfusion.Blazor.Data.Query().Take(10);
public List<TaskData> TaskCollection { get; set; }
}
RenderBaseline
Gets or sets whether to render the baseline in the Gantt chart.
Declaration
public bool RenderBaseline { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Baseline is used to display the initial planned start and end date of a task. The baseline start and end date values should be mapped from data source.
Examples
<SfGantt DataSource="@TaskCollection" RenderBaseline=true>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
public List<TaskData> TaskCollection { get; set; }
}
ResourceFields
Gets or sets an instance of GanttResourceFields<TResources> that allocates the resources (human resources) for each task.
Declaration
public GanttResourceFields<ExpandoObject> ResourceFields { get; set; }
Property Value
Type | Description |
---|---|
GanttResourceFields<System.Dynamic.ExpandoObject> | An instance of GanttResourceFields<TResources>. |
Remarks
The GanttResourceFields<TResources> class provides various properties to customizes the resource allocations.
Examples
<SfGantt DataSource="@TaskCollection" ResourceFields="ResourceFields">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
@code{
private GanttResourceFields<ExpandoObject> resourceFields = new GanttResourceFields<ExpandoObject>()
{
ID = "ResourceId",
Name = "ResourceName"
};
public List<TaskData> TaskCollection { get; set; }
}
RowHeight
Gets or sets the height value for the grid rows and chart rows of Gantt chart.
Declaration
public int RowHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | An integer value that represents the height of the row in pixels. The default value is 36 pixel. |
Remarks
Row height can be changed by using 'RowHeight' property.
Examples
<SfGantt DataSource="@TaskCollection" RowHeight="50">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
ScrollToTaskbarOnClick
Gets or sets whether to scroll and bring the taskbar into current view port on row click action.
Declaration
public bool ScrollToTaskbarOnClick { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
For seemless view of task information you can enable this property.
SearchSettings
Gets or sets an instance of GanttSearchSettings which configures searching behavior in Gannt Chart.
Declaration
public GanttSearchSettings SearchSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttSearchSettings | An instance of GanttSearchSettings. |
Remarks
The GanttSearchSettings class provides various properties to customize searching operations.
Examples
<SfGantt DataSource="@TaskCollection" SearchSettings=ganttSearchSettings Toolbar="@(new List<string>() { "Search" })">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private GanttSearchSettings ganttSearchSettings = new GanttSearchSettings()
{
Fields = new string[] { "TaskName" },
Operator = Operator.Contains,
};
public List<TaskData> TaskCollection { get; set; }
}
SelectedRowIndex
Gets or sets the selected row index in Gantt.
Declaration
public int SelectedRowIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Row index of selected row. |
Remarks
The SelectedRowIndex
allows you to select a row at initial rendering.
Examples
<SfGantt DataSource="@TaskCollection" SelectedRowIndex=2>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
@code{
public List<TaskData> TaskCollection { get; set; }
}
SelectionSettings
Gets or sets an instance of SelectionSettings to configure the selection behavior.
Declaration
public GanttSelectionSettings SelectionSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttSelectionSettings | An instance of SelectionSettings |
Remarks
SelectionSettings class provides the properties to customize the selection action in Gantt chart.
Examples
<SfGantt DataSource="@TaskCollection" SelectionSettings = ganttSelectionSettings >
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private GanttSelectionSettings ganttSelectionSettings = new GanttSelectionSettings()
{
Mode = Syncfusion.Blazor.Grids.SelectionMode.Both
};
private List<TaskData> TaskCollection { get; set; }
}
ShowColumnChooser
Gets or sets whether to render column chooser in Gantt.
Declaration
public bool ShowColumnChooser { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property determines whether to enable or disable column chooser in the Gantt chart. Set this property to true
to enable the column chooser, or false
to disable it.
It allows you to dynamically show or hide columns.
ShowColumnMenu
Gets or sets whether to render the column menu option in each column with default items.
Declaration
public bool ShowColumnMenu { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
If 'ShowColumnMenu' set to true, then it will enable all the build in column menu items. You can customize the column menu items using Syncfusion.Blazor.Gantt.SfGantt.ColumnMenuItems.
Examples
<SfGantt DataSource="@TaskCollection" ShowColumnMenu=true>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</ SfGantt >
@code{
public List<TaskData> TaskCollection { get; set; }
}
ShowInlineNotes
Gets or sets a value that determines whether the notes column value should be displayed inside a cell or in a tooltip.
Declaration
public bool ShowInlineNotes { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ShowOverallocation
Gets or sets a value whether to highlight the time period in chart side for the resource assigned with multiple tasks happening on the same time period.
Declaration
public bool ShowOverallocation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
The time period in chart side is highlighted with square brackets. This can be useful for identifying and managing resource conflicts.
SortSettings
Gets or sets an instance of SortSettings to configure the sorting behavior.
Declaration
public GanttSortSettings SortSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttSortSettings | An instance of SortSettings |
Remarks
The SortSettings class provides the properties to customize the sorting behavior of the gantt chart.
Examples
SfGantt DataSource="@TaskCollection" AllowSorting="true" SortSettings=ganttSortSettings>
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private GanttSortSettings ganttSortSettings = new GanttSortSettings()
{
Columns = new List<GanttSortDescriptor>()
{
new GanttSortDescriptor(){ Field="TaskId", Direction=Syncfusion.Blazor.Grids.SortDirection.Descending},
}
};
public List<TaskData> TaskCollection { get; set; }
}
SplitterSettings
Gets or Sets an instance of SplitterSettings to configure the splitter panes in Gantt.
Declaration
public GanttSplitterSettings SplitterSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttSplitterSettings | An instance of SplitterSettings. |
Remarks
SplitterSettings class provides the properties to customize the splitter.
Examples
<SfGantt DataSource="@TaskCollection" SplitterSettings=ganttSplitterSettings Height="300px" Width="500px">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
public List<TaskData> TaskCollection { get; set; }
private GanttSplitterSettings ganttSplitterSettings = new GanttSplitterSettings()
{
Position = "20%"
};
}
TaskbarHeight
Gets or sets the height of the taskbar in the Gantt chart.
Declaration
public Nullable<int> TaskbarHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | Taskbar HtmlElement height in pixel. |
Examples
SfGantt DataSource="@TaskCollection" TaskbarHeight="50">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
public List<TaskData> TaskCollection { get; set; }
TaskbarSettings
Gets or sets an instance of TaskbarSettings to configure the taskbar settings behavior in Gantt.
Declaration
public GanttTaskbarSettings TaskbarSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttTaskbarSettings | An instance of TaskbarSettings. |
Remarks
Provides options to customize the multitaskbar behavior.
Examples
<SfGantt @ref = "Gantt" DataSource="@TaskCollection">
<GanttTaskbarSettings EnableMultiTaskbar="true" AllowTaskbarDragAndDrop="true">
</GanttTaskbarSettings>
</SfGantt>
TaskFields
Gets or sets an instance of TaskFields to configure the Task fields in Gantt.
Declaration
public GanttTaskFields TaskFields { get; set; }
Property Value
Type | Description |
---|---|
GanttTaskFields | An instance of TaskFields. |
Remarks
TaskFields class provides an properties to customize the Task fields.
Examples
<SfGantt DataSource="@TaskCollection" TaskFields=taskFields>
</SfGantt>
@code{
public List<TaskData> TaskCollection { get; set; }
private GanttTaskFields taskFields = new GanttTaskFields()
{
Id = "TaskId",
Name = "TaskName",
StartDate = "StartDate",
EndDate = "EndDate",
Duration = "Duration",
Progress = "Progress",
ParentID = "ParentId"
};
}
TaskMode
Gets or sets the schedule mode of tasks in the Gantt chart.
Declaration
public ScheduleMode TaskMode { get; set; }
Property Value
Type | Description |
---|---|
ScheduleMode | The available scheduling mode are,
|
Remarks
This property determines how task values in the Gantt chart will be validated.
Examples
<SfGantt DataSource="@TaskCollection" TaskMode="ScheduleMode.Auto">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate" Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
TaskType
Defines the behavior of tasks in Gantt Chart.
Declaration
public TaskType TaskType { get; set; }
Property Value
Type | Description |
---|---|
TaskType | One of the TaskType enumeration that specifies task behavior. The default type is Syncfusion.Blazor.Gantt.TaskType.FixedUnit. |
Remarks
The availble Task types are,
- NoneFields are None.
- FixedDurationDuration task field will remain constant while updating resource unit or work field.
- FixedWorkWork field will remain constant while updating resource unit or duration field.
- FixedUnitResource units will remain constant while updating duration or work field.
TimelineSettings
Gets or sets an instance of GanttTimelineSettings which configures the Gannt chart timeline.
Declaration
public GanttTimelineSettings TimelineSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttTimelineSettings | An instance of GanttTimelineSettings. |
Remarks
The GanttTimelineSettings class provides various properties to customize Gantt chart timeline.
Examples
<SfGantt DataSource="@TaskCollection" TimelineSettings=ganttTimelineSettings Height="450px" Width="1000px">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private GanttTimelineSettings ganttTimelineSettings = new GanttTimelineSettings()
{
TimelineUnitSize = 45,
TimelineViewMode = TimelineViewMode.Week
};
private List<TaskData> TaskCollection { get; set; }
}
TimelineTierSettings
Gets or sets an instance of TimelineTierSettings to configure the time line tier setting.
Declaration
public GanttTimelineTierSettings TimelineTierSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttTimelineTierSettings | An instance of TimelineTierSettings |
Remarks
The TimelineTierSettings class provides the various properties to customize timeline tier setting.
Toolbar
Gets or sets the toolbar items in Gantt.
Declaration
public object Toolbar { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The available built-in toolbar items are:
|
Remarks
The toolbar items are strings that represent built-in or custom actions that can be performed on the Gantt tasks. Both built-in and custom toolbar items can be added to toolbar.
Examples
<SfGantt @ref = "Gantt" DataSource="@TaskCollection" Toolbar="@(new List<string>() { "Add", "Cancel", "Delete", "Edit", "Update", new ItemModel() { Text = "QuickFilter", TooltipText = "Quick Filter", PrefixIcon = "e-click", Id = "QuickFilter" }})">
</SfGantt>
TooltipSettings
Gets or sets an instance of TooltipSettings to configure the tooltip behavior in the Gantt.
Declaration
public GanttTooltipSettings<TValue> TooltipSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttTooltipSettings<TValue> | An instance of TooltipSettings. |
Remarks
The TooltipSettings class provides the properties to customize the tooltip setting.
Examples
<SfGantt @ref = "Gantt" ID="GanttEditing" DataSource="@TaskCollection">
<GanttTooltipSettings ShowTooltip="true">
<TaskbarTemplate>
@{
<div>TaskID: @context.TaskId</div>
}
</TaskbarTemplate>
</GanttTooltipSettings>
</SfGantt>
TreeColumnIndex
Gets or sets a column index that is used to expand or collapse its child rows.
Declaration
public int TreeColumnIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Tree column index, for example integer value 4.The default value is 0. |
Remarks
The TreeColumnIndex property determines which column in the Gantt chart should be used to display the tree structure. Tree column index can be changed by using 'TreeColumnIndex' property.
Examples
<SfGantt @ref = "Gantt" DataSource="@TaskCollection" TreeColumnIndex="1">
</SfGantt>
ValidateManualTasksOnLinking
Gets or sets whether to validate date values while connecting manually scheduled tasks with predecessor.
Declaration
public bool ValidateManualTasksOnLinking { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
<SfGantt @ref = "Gantt" DataSource="@TaskCollection" ValidateManualTasksOnLinking="True">
</SfGantt>
ViewType
Gets or sets an instance of ViewType to configure the view type.
Declaration
public ViewType ViewType { get; set; }
Property Value
Type | Description |
---|---|
ViewType | An instance of ViewType. |
Remarks
Syncfusion.Blazor.Gantt.SfGantt`1.viewType enum class provides an properties to customize the viewType.
Width
Gets or sets the Width of the Gantt Component container.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | Pixel or percentage values. The default value is "auto". |
WorkUnit
Gets or sets an instance of Syncfusion.Blazor.Gantt.SfGantt`1.workUnit to configure Work unit.
Declaration
public WorkUnit WorkUnit { get; set; }
Property Value
Type | Description |
---|---|
WorkUnit | An instance of WorkUnit |
Remarks
The Syncfusion.Blazor.Gantt.SfGantt`1.workUnit enum class provides the properties to customize work unit.
WorkWeek
Gets or sets the workweek of project.
Declaration
public string[] WorkWeek { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | An array of strings that represents the working days of the week. The default value is |
Examples
<SfGantt DataSource="@TaskCollection" WorkWeek="@(new string[] { "Monday","Tuesday"})">
</SfGantt>
ZoomTimelineSettings
Gets or sets an instance of ZoomTimelineSettings to configure the timeline zooming behavior.
Declaration
public GanttZoomTimelineSettings ZoomTimelineSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttZoomTimelineSettings | An instance of ZoomTimelineSettings. |
Remarks
Use this property to control the behavior of the zoom timeline, such as the minimum and maximum zoom levels and the steps to increment or decrement the zoom level. The ZoomTimelineSettings class provides an properties to customize the zoomtimeline action.
Methods
AddPredecessor(Guid, String)
Adds the dependency between the tasks. Task relationships are categorized into four types based on the start and finish dates of the task. SScannot start the task until the dependent task also start. SFcannot finish the task until the dependent task also start. FScannot start the task until the dependent task also completed. FFcannot finish the task until the dependent task also completed.
Declaration
public void AddPredecessor(Guid id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The task of value ‘id’ property of Id class. |
System.String | predecessorString | The dependency relationship type. |
Examples
<button @onclick="AddPredecessorfunc">Add Predecessor</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task AddPredecessorFunc()
{
await gantt.AddPredecessor(“9245fe4a-d402-451c-b9ed-9c1a04247482”,”3F2504E0-4F89-11D3-9A0C-0305E82C3301 FS”); /// pass task id and predecessor type.
}
}
AddPredecessor(Int32, String)
Adds the dependency between the tasks. Task relationships are categorized into four types based on the start and finish dates of the task. SScannot start the task until the dependent task also start. SFcannot finish the task until the dependent task aso start. FScannot start the task until the dependent task is completed. FFcannot finish the task until the dependent task is Completed.
Declaration
public void AddPredecessor(int id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The task value of |
System.String | predecessorString | The dependency relationship type. |
Remarks
Adds the dependency between the tasks by passing TaskId and dependency type.
Examples
<button @onclick="AddPredecessorFunc">Add Predecessor</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public void AddPredecessorFunc()
{
gantt.AddPredecessor(12,"4FS");
}
}
AddPredecessor(String, String)
Adds the dependency between the tasks. Task relationships are categorized into four types based on the start and finish dates of the task. SScannot start the task until the dependent task also start. SFcannot finish the task until the dependent task also start. FScannot start the task until the dependent task also completed. FFcannot finish the task until the dependent task also completed.
Declaration
public void AddPredecessor(string id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task of value ‘id’ property of Id class. |
System.String | predecessorString | The dependency relationship type. |
Examples
<button @onclick="AddPredecessorfunc">Add Predecessor</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task AddPredecessorFunc()
{
await gantt.AddPredecessor(“ABCD12”,”ABCS FS”); /// pass task id and predecessor type.
}
}
AddRecordAsync(TValue, Nullable<Int32>, Nullable<RowPosition>, Object)
Adds the new record into gantt chart asynchronously.
Declaration
public Task AddRecordAsync(TValue data, Nullable<int> index = null, Nullable<RowPosition> position = null, object resourceData = null)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The new record to be added. |
System.Nullable<System.Int32> | index | The index in which new record is to be added. |
System.Nullable<RowPosition> | position | The position such as Below, Above or Child, in which new record is to be added. |
System.Object | resourceData | The resourceData is added to the new resource assignment DataSource collection when adding a new task record. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
When index and position parameter are not passed, new record is added at top first row index.
AllowAdding should be true.
Examples
<button @onclick="AddItemFunc">Add Record</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
<GanttAssignmentFields TValue="TaskData" TAssignment="ResourceAssignmentData" PrimaryKey="Id" TaskID="TaskId" ResourceID="ResourceId" Units="Unit" DataSource="@ResourceAssignmentCollection">
</GanttAssignmentFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task AddItemFunc()
{
ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData()
{
Id = 14,
TaskId = 2,
ResourceId = 5,
Unit = 40
};
TaskData data = new TaskData(30,"ProjectApproval", new DateTime(2022,04,01),new DateTime(2022,04,05),"5",56,29);
await gantt.AddRecordAsync(data,29, RowPosition.Below, resourceAssignmentData);
}
}
AddResourceAssignmentAsync<TAssignment>(TAssignment)
Assigns a resource to the task data.
Declaration
public Task AddResourceAssignmentAsync<TAssignment>(TAssignment resourceAssignment)
Parameters
Type | Name | Description |
---|---|---|
TAssignment | resourceAssignment | The resource assignment data to be added. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TAssignment | The type of resource assignment data. |
Remarks
Use this method to add a new resource assignment to the task data. The resourceAssignment
parameter should contain the necessary information such as the, primary key, task ID, resource ID, and any additional details required for the assignment.
Examples
<button @onclick="AddResourceAssignmentFunc">Add ResourceAssignment</button>
<SfGantt<TaskData> @ref="gantt" DataSource="@TaskCollection">
<GanttAssignmentFields TValue="TaskData" TAssignment="ResourceAssignmentData" PrimaryKey="Id" TaskID="TaskId" ResourceID="ResourceId" Units="Unit" DataSource="@ResourceAssignmentCollection">
</GanttAssignmentFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void AddResourceAssignmentFunc()
{
ResourceAssignmentData newResourceAssignment = new ResourceAssignmentData()
{
Id = 14,
TaskId = 2,
ResourceId = 5
};
await gantt.AddResourceAssignmentAsync(newResourceAssignment);
}
}
AutoFitColumnsAsync(String[])
Updates the column width to autofit their content, ensuring that the width displays the content without wrapping or hiding.
Declaration
public Task AutoFitColumnsAsync(string[] fieldNames)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | fieldNames | A collection of column names to be autofitted. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Use this method to update the width of specified columns to autofit their content. Autofitting ensures that the column width is adjusted dynamically to display the content without wrapping or hiding. This method is typically used within the DataBound event to autofit columns during the initial rendering.
Examples
Use the following code to automatically fit columns to their content:
<button id="AutofitColumns" @onclick="FitColumnsHandler">FitColumns</button>
<SfGantt @ref="Gantt" DataSource="@GanttData">
........
</SfGantt>
@code
{
SfGantt<TaskData> Gantt;
private async Task FitColumnsHandler()
{
await Gantt.AutofitColumnsAsync(new[] { "TaskName", "Duration" }); // Pass the desired column field names
}
}
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
CallStateHasChangedAsync()
Declaration
public Task CallStateHasChangedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
CancelEdit()
Cancels the current edit operation in the Gantt chart component.
Declaration
public void CancelEdit()
Remarks
Closes the add or edit form without saving changes.
Examples
<button @onclick="CancelEditFunc">Cancel Edit</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public void CancelEditFunc()
{
gantt.CancelEdit();
}
}
ClearFilteringAsync()
Clears all filtering that has been applied to the current data set or from all columns in the Gantt chart Component.
Declaration
public Task ClearFilteringAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
Clears the filtered rows of Gantt chart. This method will reset all filters applied to the data set, resulting in all data being shown.
Examples
<button @onclick="ClearFilterFunc">Clear Filtering </button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ClearFilterFunc()
{
await gantt.ClearFilteringAsync();
}
}
ClearSelectionAsync()
Clears all the selected rows and cells in Gantt chart.
Declaration
public Task ClearSelectionAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
Currently selected rows and cells in Gantt chart are cleared. This method can be used to clear the currently selected items in a gantt chart component.
Examples
<button @onclick="ClearSelectionFunc">Clear Slection</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ClearSelectionFunc()
{
await gantt.ClearSelectionAsync();
}
}
ClearSortingAsync()
Clears the current sorting from all the columns of the gantt chart.
Declaration
public Task ClearSortingAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
Clear all the sorted columns in Gantt chart. This method can be used to clear the sorting applied on a gantt chart component.
Examples
<button @onclick="ClearSortingFunc">Clear Sorting</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ClearSortingFunc()
{
await gantt.ClearSortingAsync();
}
}
CollapseAllAsync()
Collapses all the parent rows or items in a collection.
Declaration
public Task CollapseAllAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method can be used to collapse all parent rows and items in a gantt chart component that can be expanded and collapsed.
Examples
<button @onclick="CollapseHandler">Collapse All</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task CollapseHandler()
{
await gantt.CollapseAllAsync();
}
}
CollapseAtLevelAsync(Int32)
Collapses the records along with its child records, at specific hierarchical level.
Declaration
public Task CollapseAtLevelAsync(int level)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | level | The level of the record until which the rows to be Collapsed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task.A task that represents the asynchronous operation. |
Remarks
This method can be used to collapse the record to a certain level in an asynchronous manner. The method will update the records without blocking the current thread. The task completes when the collapse operation is finished. The level parameter should be a non-negative integer representing the level of the records to collapse to. The root parent level is 0.
Examples
<button @onclick="CollapseLevel">CollapseLevel</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task CollapseLevel()
{
await gantt.CollapseAtLevelAsync(12); /// pass the hierarchical level
}
}
CollapseByKeyAsync(Object)
Collapses a record based on the primary key value of the record asynchronously.
Declaration
public Task CollapseByKeyAsync(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The primary key value of the record to be collapsed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
Collapse a record based on the primary key value of the record.
The task returned by this method will complete when the operation is complete.
The field value of Id
property of Id class is the primary key of the record.
Examples
<button @onclick="CollapseKey">CollapseKey</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task CollapseKey()
{
await gantt.CollapseByKeyAsync(12); /// pass primary key value here
}
}
ConvertToMilestone(String)
Converts task data to Milestone data based on the given task id.
Declaration
public void ConvertToMilestone(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task value of |
Remarks
This method will convert the task with the given id to a milestone. The task's start and end date will be set to the same value.
Examples
<button @onclick="ClickHandler">Convert To MileStones</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void ClickHandler()
{
gantt.ConvertToMilestone("1");
}
}
CopyAsync(Nullable<Boolean>)
Declaration
public Task CopyAsync(Nullable<bool> withHeader = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Boolean> | withHeader | Indicates whether the header row should be included in the copy. If set to null, the header will not be copied. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method is intended to be used for copying cells from gantt chart. The behavior of copying the record can be modified using CopyHierarchyType enumeration property.
Examples
!
<button id="Copy" @onclick="CopyHandler">Copy</button>
<SfGantt @ref="Gantt" DataSource="GanttData">
. . . .
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
private async Task CopyHandler(){
await Gantt.CopyAsync(true);
}
}
DeleteRecordAsync(Guid)
Deletes a record from Gantt chart component.
Declaration
public Task DeleteRecordAsync(Guid TaskID)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | TaskID | The task of value ‘Id’ property of Id class to be deleted. The unique identifier of the record to delete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous oepration. |
Remarks
When the parameters are not passed, the selected record will be deleted. It accepts an unique identifier of a record as a parameter. AllowDeleting should be true.
Examples
<button @onclick="DeleteRecordFunc">Delete Record</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task DeleteRecordFunc()
{
await gantt.DeleteRecordAsync(“3F2504E0-4F89-11D3-9A0C-0305E82C3301”); /// pass task id.
}
}
DeleteRecordAsync(Nullable<Int32>)
Deletes a record from Gantt chart component.
Declaration
public Task DeleteRecordAsync(Nullable<int> TaskID = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | TaskID | The task value of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that represents the asynchronous operation. System.Threading.Tasks.Task. |
Remarks
AllowDeleting should be true.
Examples
<button @onclick="DeleteRecordFunc">Delete Record</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task DeleteRecordFunc()
{
await gantt.DeleteRecordAsync(2);
}
}
DeleteRecordAsync(String)
Deletes a record from Gantt chart component.
Declaration
public Task DeleteRecordAsync(string TaskID)
Parameters
Type | Name | Description |
---|---|---|
System.String | TaskID | The task of value ‘Id’ property of Id class to be deleted. The unique identifier of the record to delete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
When the parameters are not passed, the selected record will be deleted. It accepts an unique identfier of a record as a parameter. AllowDeleting should be true.
Examples
<button @onclick="DeleteRecordFunc">Delete Record</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task DeleteRecordFunc()
{
await gantt.DeleteRecordAsync(“ABCD12”); /// pass task id.
}
}
DeleteResourceAssignmentAsync<TAssignment>(TAssignment)
Removes a resource for a task.
Declaration
public Task DeleteResourceAssignmentAsync<TAssignment>(TAssignment resourceAssignment)
Parameters
Type | Name | Description |
---|---|---|
TAssignment | resourceAssignment |
Returns
Type |
---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TAssignment | The type of the resource assignment data. |
Remarks
Use this method to remove a resource assignment associated with a task. The resourceAssignment
parameter should contain the necessary information such as the task ID and resource ID for the assignment to be removed.
Examples
<button @onclick="RemoveResourceAssignmentFunc">Remove ResourceAssignment</button>
<SfGantt<TaskData> @ref="gantt" DataSource="@TaskCollection">
<GanttAssignmentFields TValue="TaskData" TAssignment="ResourceAssignmentData" PrimaryKey="Id"TaskID="TaskId" ResourceID="ResourceId" Units="Unit" DataSource="@ResourceAssignmentCollection">
</GanttAssignmentFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void RemoveResourceAssignmentFunc()
{
ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData()
{
TaskId = 2,
ResourceId = 5,
};
await gantt.DeleteResourceAssignmentAsync (resourceAssignmentData);
}
}
EnableItems(List<Int32>, Boolean)
Enable or disable the toolbar items dynamically.
Declaration
public void EnableItems(List<int> items, bool isEnable)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Int32> | items | Indexes of toolbar Items to be enabled or disabled |
System.Boolean | isEnable | A boolean value indicating whether the items should be enabled (true) or disabled (false). |
Remarks
This method can be used to enable or disable items in a list, depending on the value of the isEnable parameter.
If isEnable
is set to true, the items will be enabled.
If isEnable
is set to false, the items will be disabled.
Examples
<button @onclick="EnableItemFunc">Enable Items</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection" Toolbar="Toolbaritems">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public List<ItemModel> Toolbaritems = new List<ItemModel>() { new ItemModel() { Text = "Quick Filter", TooltipText = "Quick Filter", Id = "quickfilter" },
new ItemModel() { Text = "Clear Filter", TooltipText = "Clear Filter", Id = "clearfilter" }};
}
private async Task EnableItemFunc()
{
await gantt.EnableItems(new List<int>() { 0,1 },true);
}
}
ExpandAllAsync()
Expands all the parent rows of Gantt chart.
Declaration
public Task ExpandAllAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous expand operation. |
Remarks
This method can be used to expand all nodes in the gantt chart. It can be useful for instance when you need to show the whole gantt chart structure at once.
Examples
<button @onclick="ExpandAllFunc">Expand All</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ExpandAllFunc()
{
await gantt.ExpandAllAsync();
}
}
ExpandAtLevelAsync(Int32)
Expands the records along with its parent at specific hierarchical level.
Declaration
public Task ExpandAtLevelAsync(int level)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | level | The hierarchical level until which the rows to be Expanded. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that represents the asynchronous operation. |
Remarks
This method can be used to expand the records to a certain level in an asynchronous manner. The method will update the records without blocking the current thread. The task completes when the expand operation is finished. The level parameter should be a non-negative integer representing the level of the records to expand to. The root parent level is 0.
Examples
<button @onclick="ExpandLevel">ExpandLevel</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ExpandLevel()
{
await gantt.ExpandAtLevelAsync(12); /// pass the hierarchical level
}
}
ExpandByKeyAsync(Object)
Expands a record identified by the primary key value of the record.
Declaration
public Task ExpandByKeyAsync(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | The primary key value of the record to be expanded. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous expansion operation. |
Remarks
Expand a record based on the primary key value of the record.
The Id
property of Id is the primary key of the record by default.
Examples
<button @onclick="ExpandKey">ExpandKey</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ExpandKey()
{
await gantt.ExpandByKeyAsync(12); /// pass primary key value here
}
}
ExportToCsvAsync()
Exports the Gantt chart data to CSV formal excel file.
Declaration
public Task ExportToCsvAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method can be used to export data to a CSV file. AllowExcelExport should be enabled.
Examples
<button @onclick="ExportToCsvFunc">Export to CSV</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ExportToCsvFunc()
{
await gantt.ExportToCsvAsync();
}
}
ExportToCsvAsync(ExcelExportProperties)
Exports the Gantt chart data to CSV format excel file with provided properties.
Declaration
public Task ExportToCsvAsync(ExcelExportProperties excelExportProperties)
Parameters
Type | Name | Description |
---|---|---|
ExcelExportProperties | excelExportProperties | Options for customizing the excel document during export. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method can be used to export data to a CSV file.
Examples
/// <SfGantt @ref="gantt" DataSource="@TaskCollection"Toolbar="@(new List<string>() { "CsvExport" })">
<GanttEvents OnToolbarClick="ToolbarClickHandler" TValue="TaskData"></GanttEvents>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
Syncfusion.Blazor.Grids.ExcelExportProperties ExportProperties = new Syncfusion.Blazor.Grids.ExcelExportProperties();
Syncfusion.Blazor.Grids.ExcelStyle ThemeStyle = new Syncfusion.Blazor.Grids.ExcelStyle()
{
FontName = "Segoe UI",
FontColor = "#666666",
FontSize = 12
};
Theme.Header = ThemeStyle;
Theme.Record = ThemeStyle;
ExportProperties.Theme = Theme;
if (args.Item.Text == "CSV export")
{
await this.Gantt.CsvExport(ExportProperties);
}
}
}
ExportToExcelAsync()
Exports the Gantt chart data to an Excel file asynchronously.
Declaration
public Task ExportToExcelAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method will export data to an excel file in a separate thread, allowing the caller to continue executing while the export is in progress. AllowExcelExport should be enabled.
Examples
<button @onclick="ExportToExcelFunc">Export to Excel</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ExportToExcelFunc()
{
await gantt.ExportToExcelAsync();
}
}
ExportToExcelAsync(ExcelExportProperties)
Asynchronously Exports the Gantt chart data to Excel file.
Declaration
public Task ExportToExcelAsync(ExcelExportProperties excelExportProperties)
Parameters
Type | Name | Description |
---|---|---|
ExcelExportProperties | excelExportProperties | An object containing the properties of the excel export. The options for customizing the excel document during export. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous excel export operation. |
Remarks
excelExportProperties
should contain information such as file name, sheet name, data to be exported and any other information related to excel export.
ExcelExportProperties class provides various properties to customize Excel export.
AllowExcelExport should be enabled.
Examples
<SfGantt @ref="gantt" DataSource="@TaskCollection"Toolbar="@(new List<string>() { "ExcelExport" })">
<GanttEvents OnToolbarClick="ToolbarClickHandler" TValue="TaskData"></GanttEvents>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
Syncfusion.Blazor.Grids.ExcelExportProperties ExportProperties = new Syncfusion.Blazor.Grids.ExcelExportProperties();
Syncfusion.Blazor.Grids.ExcelStyle ThemeStyle = new Syncfusion.Blazor.Grids.ExcelStyle()
{
FontName = "Segoe UI",
FontColor = "#666666",
FontSize = 12
};
Theme.Header = ThemeStyle;
Theme.Record = ThemeStyle;
ExportProperties.Theme = Theme;
if (args.Item.Text == "Excel export")
{
await this.Gantt.ExcelExport(ExportProperties);
}
}
}
ExportToPdfAsync(GanttPdfExportProperties)
Exports the Gantt chart data to a Pdf document.
Declaration
public Task ExportToPdfAsync(GanttPdfExportProperties pdfExportProperties = null)
Parameters
Type | Name | Description |
---|---|---|
GanttPdfExportProperties | pdfExportProperties | An object containing the properties of the PDF export. The options for customizing the PDF document during export. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous Pdf export operation. |
Remarks
pdfExportProperties
should contain information such as file name, data to be exported and any other information related to PDF export.
GanttPdfExportProperties class provides various properties to customize PDF export.
AllowPdfExport should be enabled.
Examples
<SfGantt @ref="Gantt" DataSource="@TaskCollection" AllowPdfExport="true" Toolbar="@(new List<string>(){"PdfExport"})">
<GanttEvents OnToolbarClick="ToolbarClickHandler" TValue="TaskData"></GanttEvents>
</SfGantt>
@code{
private SfGantt<TaskData> Gantt;
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args){
GanttPdfExportProperties exportProperties = new GanttPdfExportProperties();
exportProperties.FileName = "New File.pdf";
if(args.Item.Text == "PDF export")
{
await Gantt.ExportToPdfAsync(exportProperties);
}
}
}
FilterByColumnAsync(String, String, String, String, Nullable<Boolean>, Nullable<Boolean>)
Filters the Gantt chart data based on the specified column and criteria asynchronously.
Declaration
public Task FilterByColumnAsync(string fieldName, string filterOperator, string filterValue, string predicate = null, Nullable<bool> enableMatchCase = null, Nullable<bool> isIgnoreAccent = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | The name of the column by which the Gantt chart data will be filtered. |
System.String | filterOperator | The filtering operator represented as a string. See Operator for available operators. |
System.String | filterValue | The value used for filtering the specified column. |
System.String | predicate | Specifies a predicate condition (e.g., AND, OR) for filtering multiple values. It is useful for multiple values filtering. Use |
System.Nullable<System.Boolean> | enableMatchCase | Specifies whether the filtering operation should be case-sensitive. It is an optional parameter. |
System.Nullable<System.Boolean> | isIgnoreAccent | Specifies whether the filtering operation ignores accent differences. It is an optional parameter. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous filter operation. |
Remarks
This method asynchronously filters the Gantt chart data by the specified column and criteria.
Additional options such as predicate, enableMatchCase, and isIgnoreAccent can be utilized to customize the filtering operation.
The predicate parameter allows for specifying a predicate condition (e.g., AND, OR) for filtering multiple values, which is optional.
Examples
Use the following code to filter the Gantt chart data by a specific column and value:
<button @onclick="FilterByColumn>Filter By Column</button>
<SfGantt @ref="gantt" DataSource="@GanttData">
........
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task FilterByColumn()
{
await gantt.FilterByColumnAsync("TaskName", "startswith", "Iden", “or”, true, false);
}
}
GetColumnIndexByFieldAsync(String)
Returns the index of a particular column based on the field name.
Declaration
public Task<int> GetColumnIndexByFieldAsync(string field)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | A string value representing the name of the field whose index is to be returned. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | An integer value representing the index of the column. A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method is asynchronous and should be awaited when called.
Examples
The following code shows how to use this method:
<button @onclick="GetColumnIndex">Get ColumnIndexByField</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task GetColumnIndex()
{
await gantt.GetColumnIndexByFieldAsync("id"); //pass the field name of the column.
}
}
GetColumnsAsync()
Returns the columns collection from the Gantt Chart.
Declaration
public Task<List<GanttColumn>> GetColumnsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<GanttColumn>> | A task that represents the asynchronous operation, the task result contains a list of GanttColumns.System.Threading.Tasks.Task. |
Remarks
This method can be used to retrieve the columns of a Gantt chart asynchronously. The method will retrieve the columns without blocking the current thread. The task completes when the retrieval operation is finished.
Examples
<button @onclick="ClickHandler">GetColumns</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ClickHandler()
{
var columns = await gantt.GetColumnsAsync();
}
}
GetCriticalTasksAsync()
Retrieves a collection of critical tasks asynchronously.
Declaration
public List<TValue> GetCriticalTasksAsync()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<TValue> | A System.Threading.Tasks.Task that represents the asynchronous operation. The task result is a list of critical tasks. |
Remarks
This method retrieves a list of critical tasks that require immediate attention to ensure a project is completed on time.
Examples
!
<button id="Critical" @onclick="CriticalTasks">CriticalTask</button>
<SfGantt @ref="Gantt" DataSource="GanttData">
. . . .
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
private List<TaskData> CriticalTasks(){
var data = Gantt.GetCriticalTasksAsync();
return data;
}
}
GetCurrentViewRecords()
Retrieves a list of the currently visible records in Gantt Chart. For example, when virtualization is disabled, it returns all records including the child records in expanded state. When virtualization is enabled, it returns the record and child records in current view port it might include the records over scanned for smooth scrolling.
Declaration
public List<TValue> GetCurrentViewRecords()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<TValue> | A System.Threading.Tasks.Task that gives visible records in current view. |
Remarks
This method can be called to retrieve a list of all records that are currently displayed in the view. Helps to obtain the data currenlty rendered in DOM.
Examples
<button id=”GetCurrentViewData” @onclick=” GetCurrentViewData”> GetCurrentViewData </button>
<SfGantt @ref=”Gantt” DataSource=”GanttData”>
<GanttEditSettings AllowEditing=”true”/>
…
</GanttEditSettings>
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
private async task BatchAddHandler (){
var data = await Gantt.GetcurrentviewRecordsAsync ();
}
}
GetFilteredRecordsAsync()
Retrieves all filtered records asynchronously from Gantt Chart as collection of data objects for the local data source, and returns a promise object if the Gantt Chart has remote data binding.
Declaration
public Task<List<TValue>> GetFilteredRecordsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<TValue>> | A System.Threading.Tasks.Task that represents the asynchronous operation. The task result contains a list of filtered records of type. |
Remarks
Helps to obtain the filtered data after filtering in Gantt Chart. This method should be used to retrieve a list of filtered records based on some criteria. The method should run asynchronously to avoid blocking the UI thread.
Examples
<button id=”GetFilteredRecords” @onclick=”FilterHandler”> GetFilteredRecords</button>
<SfGantt @ref=”Gantt” DataSource=”GanttData”>
<GanttEditSettings AllowFiltering=”true” />
…
</GanttEditSettings>
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
private async task FilterHandler (){
var data = await Gantt.GetFilteredRecordsAsync();
}
}
GetHierarchicalData(Int32)
Retrieves the hierarchical data for a specified Id.
Declaration
public ExpandoObject GetHierarchicalData(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The Id of the data to retrieve |
Returns
Type | Description |
---|---|
System.Dynamic.ExpandoObject | System.Dynamic.ExpandoObject. |
Remarks
Shows the hierarchical relation properties of the tasks in the Gantt chart component.
Examples
<button @onclick="GetHierarchyInfo">Get Hierarchial Data</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void GetHierarchyInfo()
{
var recordInfo = gantt.GetHierarchicalData(1);
}
}
GetPersistDataAsync()
Returns the serialized gantt chart properties to be maintained in the persisted state.
Declaration
public Task<string> GetPersistDataAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | A task representing the asynchronous operation.The result of the task is a string that contains the persist data. System.Threading.Tasks.Task. |
Remarks
The persist data returned by this method should be stored in a secure location and encrypted if necessary. Ensure that the storage used in this method is reliable and can handle high read/write workloads. Users can use this method to later restore the gantt chart state through SetPersistDataAsync(String) method.
Examples
<button id="GetPersistence" @onclick="GetPersistence">Get Persistence</button>
<SfGantt @ref = "gantt" EnablePersistence=”true” DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public string currentState;
private async Task GetPersistence()
{
currentState= await gantt.GetPersistDataAsync();
}
}
GetRecordByID(String)
Returns a record from Gantt chart data source based on the given ID.
Declaration
public IDictionary<string, object> GetRecordByID(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task value of |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | A dictionary that contains the record's field names and corresponding values.. |
Remarks
This method can be used to retrieve a record from the data source based on the given ID. The returned dictionary contains the field names and corresponding values of the record. If the ID is not found, the method will return null.
GetResourceAssignments<TAssignment>(TValue)
Gets the resource assignments for the specified task data.
Declaration
public List<TAssignment> GetResourceAssignments<TAssignment>(TValue data)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The task data for which the resource assignments are to be retrieved. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<TAssignment> | A list of resource assignments for the specified data. |
Type Parameters
Name | Description |
---|---|
TAssignment | The type of resource assignment model. |
Remarks
This method is intended to retrieve a list of resource assignments for the specified data, such as the resource assignment collection.
Examples
<SfGantt @ref="Gantt" DataSource="@GanttData">
<GanttEvents TValue="TaskData" RowSelected="RowSelect"></GanttEvents>
........
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
public void RowSelect(RowSelectEventArgs<TaskData> args)
{
var resourceAssignments = Gantt.GetResourceAssignments<ResourceAssignmentModel>(args.Data);
}
}
GetResources<TResources>(TValue)
Gets the resources for the specified task data.
Declaration
public List<TResources> GetResources<TResources>(TValue data)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The task data for which the resources are to be retrieved. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<TResources> | A list of resources for the specified data. |
Type Parameters
Name | Description |
---|---|
TResources | The type of resource. |
Remarks
This method is intended to retrieve resources associated with the specified task data, such as resource names and other relevant details.
Examples
<SfGantt @ref="Gantt" DataSource="@GanttData">
<GanttEvents TValue="TaskData" RowSelected="RowSelect"></GanttEvents>
........
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
public void RowSelect(RowSelectEventArgs<TaskData> args)
{
var resources = Gantt.GetResources<ResourceModel>(args.Data);
}
}
GetRowTaskModel(TValue)
Gets the Gantt task model for the specified data.
Declaration
public IGanttTaskModel<TValue> GetRowTaskModel(TValue data)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The data for which to retrieve the Gantt task model. |
Returns
Type | Description |
---|---|
IGanttTaskModel<TValue> | An IGanttTaskModel<TValue> object representing the Gantt task model for the specified data. |
Remarks
This method is intended to be get the objects that are part of the Gantt task model for the specified data, such as the expanded state, task width, task left, task progress width and etc.
Examples
<SfGantt @ref="Gantt" DataSource="@GanttData">
<GanttEvents TValue="TaskData" RowSelected="RowSelect"></ GanttEvents >
........
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
public void RowSelect(RowSelectEventArgs<TaskData> args)
{
var ganttItem = Gantt.GetRowTaskModel(args.Data);
}
}
GetSelectedRecordsAsync()
Returns the collections of selected records in Gantt chart component asynchronously.
Declaration
public Task<List<TValue>> GetSelectedRecordsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<TValue>> | A task that represents the asynchronous operation, the task result contains a list of selected records of type TValue.System.Threading.Tasks.Task. |
Remarks
This method can be used to retrieve the selected records in the gantt chart asynchronously. The method will retrieve the records without blocking the current thread. The task completes when the retrieval operation is finished. The returned list of records my be empty if not rows are currently selected.
Examples
<button @onclick="GetSelectedRecords">Get Selected Record </button>
<SfGantt @ref="gantt" TValue="TaskData">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async GetSelectedRecords()
{
await gantt.GetSelectedRecordsAsync();
}
}
GetSelectedRowCellIndexesAsync()
Retrieves the collection of indexes of selected row and cells .
Declaration
public Task<List<ValueTuple<int, int>>> GetSelectedRowCellIndexesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<System.ValueTuple<System.Int32, System.Int32>>> | A list of value tuples representing the row and column indexes of the selected cells. A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
Using this method, selected cell or row data can be obtained for any custom actions on selected data. A list of value tuples representing the row and column indexes of the selected cells.
Examples
<button id=”GetSelectedRowCellIndexes” @onclick=” GetSelectedRowCellIndexes”>GetSelectedRowCellIndexes </button>
<SfGantt @ref=”Gantt” DataSource=”GanttData”>
</SfGantt>
@code{
SfGantt<TaskData> Gantt;
private async task GetSelectedRowCellIndexes(){
var data = await Gantt. GetSelectedRowCellIndexesAsync();
}
}
GetSelectedRowIndexesAsync()
Returns the collection of selected rows indexes.
Declaration
public Task<List<int>> GetSelectedRowIndexesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<System.Int32>> | A task that represents the asynchronous operation, the task result contains a list of doubles representing the indexes of the selected rows.System.Threading.Tasks.Task. |
Remarks
This method can be used to retrieve the indexes of the currently selected rows in the gantt chart asynchronously. The method will retrieve the indexes without blocking the current thread. The task completes when the retrieval operation is finished. The returned list of indexes may be empty if no rows are currently selected.
Examples
<button @onclick="GetSelectedRow">Get Selected Row Index</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task GetSelectedRow()
{
await gantt.GetSelectedRowIndexesAsync();
}
}
GetTaskByID(String)
Returns a record from Gantt chart data source based on the given ID.
Declaration
public TValue GetTaskByID(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task value of |
Returns
Type | Description |
---|---|
TValue | A TValue that contains the record's field names and corresponding values.. |
Remarks
This method can be used to retrieve a record from the data source based on the given ID. The returned TValue contains the field names and corresponding values of the record. If the ID is not found, the method will return null.
HideColumnAsync(String, String)
Hides a column by column name and the condition by which it was hidden.
Declaration
public Task HideColumnAsync(string key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The column name to be hidden. |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous hide operation. |
Remarks
The column will be hidden and will no longer be displayed to the user. You can dynamically hide a column.
Examples
<button @onclick="HideColumnFunc">Hide Column</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task HideColumnFunc()
{
await gantt.HideColumnAsync(new string[] {"TaskId"},"Id");
}
}
HideColumnsAsync(String[], String)
Hides the specified columns based on the column names.
Declaration
public Task HideColumnsAsync(string[] key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | key | The fields or header text of the columns to hide |
System.String | hideBy | A string value that determines the criteria for hiding columns. Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
You can dynamically hide columns.
Examples
<button @onclick="HideColumnFunc">Hide Column</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task HideColumnFunc()
{
await gantt.HideColumnAsync("TaskId","Id");
}
}
HideSpinnerAsync()
Hide the default spinner asynchronously in Gantt Chart whenever needed.
Declaration
public Task HideSpinnerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Examples
<button @onclick="HideSpinner">Hide Spinner</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task HideSpinner()
{
await gantt.HideSpinnerAsync();
}
}
IndentAsync()
Indents the record to one level of hierarchy. Moves the selected row as the last child of its previous row.
Declaration
public Task IndentAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method can be used to indent the record. The method will return a task representing the asynchronous operation. The task can be awaited to ensure that the text has been indented before continuing with the next step.
Examples
<button @onclick="IndentFunc">Indent</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task IndentFunc()
{
await gantt.IndentAsync();
}
}
MergeTaskAsync(Guid, List<ValueTuple<Int32, Int32>>)
Merges a task by its ID Id with the specified segment indexes.
Declaration
public Task MergeTaskAsync(Guid id, List<ValueTuple<int, int>> segmentIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The ID of the task to merge. Should be of type System.Guid. |
System.Collections.Generic.List<System.ValueTuple<System.Int32, System.Int32>> | segmentIndexes | The list of segment indexes to merge.This list holds the ValueTuple with from and to indexes of multiple segment |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method allows merging a task by its ID with the provided list of segment indexes.
Examples
<button @onclick="MergeTaskFunc">Merge Task</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async Task MergeTaskFunc()
{
List<ValueTuple<int, int>> indexes = new List<ValueTuple<int, int>>();
indexes.Add((0, 1));
await Gantt.MergeTaskAsync(8B23A701-4E27-4A77-A3C7-F1B14D7F7D72, indexes);
}
}
MergeTaskAsync(Int32, List<ValueTuple<Int32, Int32>>)
Merges a task by its ID Id with the specified segment indexes.
Declaration
public Task MergeTaskAsync(int id, List<ValueTuple<int, int>> segmentIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ID of the task to merge. Should be of type System.Int32. |
System.Collections.Generic.List<System.ValueTuple<System.Int32, System.Int32>> | segmentIndexes | The list of segment indexes to merge. This list holds the ValueTuple with from and to indexes of multiple segment |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method allows merging a task by its ID with the provided list of segment indexes.
Examples
<button @onclick="MergeTaskFunc">Merge Task</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void MergeTaskFunc()
{
List<ValueTuple<int, int>> indexes = new List<ValueTuple<int, int>>();
indexes.Add((0, 1));
await Gantt.MergeTaskAsync(3, indexes);
}
}
MergeTaskAsync(String, List<ValueTuple<Int32, Int32>>)
Merges a task by its ID Id with the specified segment indexes.
Declaration
public Task MergeTaskAsync(string id, List<ValueTuple<int, int>> segmentIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the task to merge. Should be of type System.String. |
System.Collections.Generic.List<System.ValueTuple<System.Int32, System.Int32>> | segmentIndexes | The list of segment indexes to merge.This list holds the ValueTuple with from and to indexes of multiple segment |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method allows merging a task by its ID with the provided list of segment indexes.
Examples
<button @onclick="MergeTaskFunc">Merge Task</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async Task MergeTaskFunc()
{
List<ValueTuple<int, int>> indexes = new List<ValueTuple<int, int>>();
indexes.Add((0, 1));
await Gantt.MergeTaskAsync("3", indexes);
}
}
ModelChanged(IDictionary<String, Object>, String)
Declaration
public void ModelChanged(IDictionary<string, object> propertyChanges, string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | propertyChanges | |
System.String | propertyName |
NextTimeSpan()
Updates the timeline at end point with one unit.
Declaration
public void NextTimeSpan()
Remarks
This method can be used to retrieve the next time span. Extends timeline with one unit after the timeline finish date.
Examples
<button @onclick="NextTimeSpanFunc">Next Time Span</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public void NextTimeSpanFunc()
{
gantt.NextTimeSpan();
}
}
OnAfterRenderAsync(Boolean)
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnInitializedBase()
Receive its initial parameters from its parent in the render tree.
Declaration
protected Task OnInitializedBase()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task. |
OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
Declaration
protected override void OnObservableChange(string propertyName, object sender, bool isCollectionChanged = false, NotifyCollectionChangedEventArgs e = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | |
System.Object | sender | |
System.Boolean | isCollectionChanged | |
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e |
Overrides
OnParametersSetAsync()
Declaration
protected override Task OnParametersSetAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnParametersSetBase()
Incoming changedValues have been assigned to properties.
Declaration
protected Task OnParametersSetBase()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task. |
OpenAddDialogAsync()
Opens a dialog to add new task asynchronously.
Declaration
public Task OpenAddDialogAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method can be used to open the add dialog in the UI. The method will return a task representing the asynchronous operation. The task can be awaited to ensure that the dialog has been opened before continuing with the next step. AllowAdding should be enabled.
Examples
<button @onclick="OpenAddDialog">Open Add Dialog</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task OpenAddDialog()
{
await gantt.OpenAddDialogAsync();
}
}
OpenColumnChooser(Nullable<Double>, Nullable<Double>)
Open column chooser pop up to show or hide columns dynamically.
Declaration
public Task OpenColumnChooser(Nullable<double> x = null, Nullable<double> y = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Double> | x | The x-coordinate at which to open the column chooser. |
System.Nullable<System.Double> | y | The y-coordinate at which to open the column chooser. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method is used to open the column chooser, which allows the user to select which columns are visible in the view. You can manually open the column chooser at any position of screen at any desired time.
Examples
<button @onclick="OpenColumnChooserFunc">Open columnChooser</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task OpenColumnChooserFunc()
{
await gantt.OpenColumnChooser(2,4);
}
}
OpenEditDialogAsync(Guid)
This method opens an edit dialog for a task with the given task ID.
Declaration
public Task OpenEditDialogAsync(Guid TaskID)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | TaskID | The task of value ‘Id’ property of Id class to be deleted. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method uses the TaskID to retrieve the task from the records collection and then opens a dialog for editing its properties. The method should be awaited to ensure that the task has been retrieved and the dialog has been opened before continuing execution. AllowEditing should be true.
Examples
<button @onclick="OpenEditDialog">Open EditDialog</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task OpenEditDialog()
{
await gantt.OpenEditDialogAsync(“3F2504E0-4F89-11D3-9A0C-0305E82C3301”); /// pass task id.
}
}
OpenEditDialogAsync(Nullable<Int32>)
Opens a dialog to edit a task asynchronously.
Declaration
public Task OpenEditDialogAsync(Nullable<int> TaskID = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | TaskID | The task value of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method can be used to open the edit dialog in the UI. The method will return a task representing the asynchronous operation. The task can be awaited to ensure that the dialog has been opened before continuing with the next step. AllowEditing should be enabled.
Examples
<button @onclick="OpenEditDialog">Open EditDialog</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task OpenEditDialog()
{
await gantt.OpenEditDialogAsync(2);
}
}
OpenEditDialogAsync(String)
Opens an edit dialog for a task with the given task ID.
Declaration
public Task OpenEditDialogAsync(string TaskID)
Parameters
Type | Name | Description |
---|---|---|
System.String | TaskID | The task of value ‘Id’ property of Id class to be deleted. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method uses the TaskID to retrieve the task from the records collection and then opens a dialog for editing its properties. The method should be awaited to ensure that the task has been retrieved and the dialog has been opened before continuing execution. AllowEditing should be true.
Examples
<button @onclick="OpenEditDialog">Open EditDialog</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task OpenEditDialog()
{
await gantt.OpenEditDialogAsync(“ABCD12”); /// pass task id.
}
}
OutdentAsync()
Outdents the record to one level of hierarchy. Moves the selected row as sibling to its parent row.
Declaration
public Task OutdentAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method Outdent the selected records. It should be awaited to ensure that the operation has been completed before continuing execution.
Examples
<button @onclick="OutdentFunc">Outdent</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task OutdentFunc()
{
await gantt.OutdentAsync();
}
}
PreventRender(Boolean)
Prevents the Gantt chart component re-render.
Declaration
public void PreventRender(bool preventRender = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | preventRender | Indicates wheter the component should be prevented from re-rendering or not. Defalut is true. |
Examples
<button @onclick="PreventRenderFunc">Prevent Render</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task PreventRenderFunc()
{
await gantt.PreventRender(true);
}
}
PreviousTimeSpan()
Goes to the previous time span.
Declaration
public void PreviousTimeSpan()
Remarks
This method can be used in cases where you want to go to the previous timespan.
Examples
<button @onclick="PreviousTimeSpanFunc">Previous TimeSpan</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
Public Void PreviousTimeSpanFunc()
{
gantt.PreviousTimeSpan();
}
}
RefreshAsync()
Refreshes the current view of the gantt chart component.
Declaration
public Task RefreshAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |
Remarks
This method refreshes the current view. It should be awaited to ensure that the operation has been completed before continuing execution. You can use this method whenever a manual refresh is needed to gantt chart.
Examples
<button @onclick="Refresh">Refresh</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task Refresh()
{
await gantt.RefreshAsync();
}
}
RefreshColumnsAsync()
Refreshed the gantt chart with columns changes, if any.
Declaration
public Task RefreshColumnsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous refresh operation. |
Remarks
This method updates the columns in the class asynchronously. Refresh the Gantt chart columns when column property values are updated externally. It returns a task that can be awaited to get the result of the operation.
Examples
<button @onclick="ClickHandler">RefreshColumns</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
<GanttColumns>
<GanttColumn Field="TaskId"></GanttColumn>
<GanttColumn Field="TaskName"></GanttColumn>
</GanttColumns>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ClickHandler()
{
gantt.Columns[0].Width = "250";
gantt.RefreshColumnsAsync();
}
}
RemovePredecessor(Guid)
Removes a predecessor from the current task based on its id.
Declaration
public void RemovePredecessor(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The task of value ‘Id’ property of Id class |
Remarks
It does not delete the predecessor task itself.
Examples
<button @onclick="RemovePredecessorFunc">Remove Predecessor</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void RemovePredecessorFunc()
{
gantt.RemovePredecessor(“3F2504E0-4F89-11D3-9A0C-0305E82C3301”); /// pass task id.
}
}
RemovePredecessor(Int32)
Removes the predecessor of the task with the given id.
Declaration
public void RemovePredecessor(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The task value of |
Examples
<button @onclick="RemovePredecessorFunc">Remove Predecessor</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public void RemovePredecessorFunc()
{
gantt.RemovePredecessor(2);
}
}
RemovePredecessor(String)
Removes a predecessor from the current task based on its id.
Declaration
public void RemovePredecessor(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task of value ‘Id’ property of Id class |
Remarks
This method will remove the predecessor task from the current task's list of predecessor tasks. It does not delete the predecessor task itself.
Examples
<button @onclick="RemovePredecessorFunc">Remove Predecessor</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void RemovePredecessorFunc()
{
gantt.RemovePredecessor(“ABCD12”); /// pass task id.
}
}
ReorderColumnsAsync(List<String>, String)
Moves the columns position in UI from one column index to another asynchoronously.
Declaration
public Task ReorderColumnsAsync(List<string> fromFName, string toFName)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.String> | fromFName | The list of current column names that needs to be reordered. |
System.String | toFName | The target column name where selected columns will be placed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method will reorder the columns in the current tree grid as per the given parameters. It moves the selected columns to the target column name in the table. AllowReordering should be enabled.
Examples
<button @onclick="ReOrderColumn">Reorder Columns</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ReOrderColumn()
{
await gantt.ReorderColumnsAsync(new List<string> {"TaskName","TaskId"},"Duration");
}
}
ReorderRowAsync(Int32, Int32, String)
Reorders the row from one index to another with a position as above, below or child to destination index.
Declaration
public Task ReorderRowAsync(int fromIndex, int toIndex, string position)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | fromIndex | The current row index from which the row needs to be moved. |
System.Int32 | toIndex | The new row index to which the row needs to be moved.. |
System.String | position | One of the string values of RowPosition that decides whether to move the row as above or below or child to destination row index |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
This method can be used to reorder a row in the gantt chart in an asynchronous manner. The method will update the index of the row without blocking the current thread. The task completes when the reorder operation is finished. The "position" parameter should be either "top" or "bottom" or "child". AllowRowDragAndDrop should be enabled.
Examples
<button @onclick="ReorderRow">Reorder Row</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ReorderRow()
{
await gantt.ReorderRowAsync(2,5,"above");
}
}
ResetPersistDataAsync()
Resets the current state and refreshes the gantt chart with original state given declaratively.
Declaration
public Task ResetPersistDataAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
Applicable when State Persistence feature is enabled in gantt chart. This method should be used to reset any data that is meant to persist across application launches. The method should run asynchronously to avoid blocking the UI thread.
Examples
<button id="ClearPersistence" @onclick="ClearPersistence">Clear Persistence</button>>
<SfGantt @ref = "gantt" EnablePersistence=”true” DataSource="@TaskCollection">
........
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async void ClearPersistence()
{
await gantt.ResetPersistDataAsync();
}
}
ResetZoomAsync()
Resets the zoom level to its initial state, as configured during the initial rendering.
Declaration
public Task ResetZoomAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method resets the zoom level to the default level set in the GanttTimelineSettings during the initial rendering.
Examples
<button @onclick="ResetZoomLevel">Reset Zoom</button>
<SfGantt @ref="Gantt" DataSource="GanttData"></SfGantt>
@code{
SfGantt<TaskData> Gantt;
private async Task ResetZoomLevel() => await Gantt.ResetZoomAsync();
}
ScrollIntoViewAsync(Int32, Int32)
Asynchronously scrolls a specific row or column into current view port.
Declaration
public Task ScrollIntoViewAsync(int columnIndex = -1, int rowIndex = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | columnIndex | The index of the column to scroll horizontally. If not provided, defaults to -1. |
System.Int32 | rowIndex | The index of the row to scroll vertically. If not provided, defaults to -1. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous scrolling operation. |
Remarks
Programmatically scrolls to view particular data in grid part of Gantt.
If both
ScrollToTaskbarAsync(Guid)
Scrolls the content to bring the taskbar(specified by task id) visible to the user.
Declaration
public Task ScrollToTaskbarAsync(Guid taskId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | taskId | The task of value ‘Id’ property of Id class |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous scrolling operation. |
Remarks
This method can be used to smoothly scroll the taskbar to bring the task to the view port with the specified task ID.
Examples
<button @onclick="ScrollToTaskbar">ScrollToTaskbar</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async task ScrollToTaskbar()
{
await gantt.ScrollToTaskbarAsync(“3F2504E0-4F89-11D3-9A0C-0305E82C3301”); /// pass the task here id.
}
}
ScrollToTaskbarAsync(Int32)
Scrolls the content to bring the taskbar (specified by task id) visible to the user.
Declaration
public Task ScrollToTaskbarAsync(int taskId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | taskId | The task value of |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous scrolling operation. |
Remarks
This method can be used to smoothly scroll the taskbar to bring the task to the view port with the specified task ID.
Examples
<button @onclick="ScrollToTaskbar">ScrollToTaskbar</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ScrollToTaskbar()
{
await gantt.ScrollToTaskbarAsync(12); /// pass the task id here
}
}
ScrollToTaskbarAsync(String)
Scrolls the content to bring the taskbar(specified by task id) visible to the user asynchronously.
Declaration
public Task ScrollToTaskbarAsync(string taskId)
Parameters
Type | Name | Description |
---|---|---|
System.String | taskId | The task of value ‘Id’ property of Id class |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous scrolling operation. |
Remarks
This method can be used to smoothly scroll the taskbar to bring the task to the view port with the specified task ID.
Examples
<button @onclick="ScrollToTaskbar">ScrollToTaskbar</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async task ScrollToTaskbar()
{
await gantt.ScrollToTaskbarAsync(“ABCD12”); /// pass the task here id.
}
}
ScrollToTimelineAsync(DateTime)
Scrolls the chart timeline horizontally to a specific date or time asynchronously.
Declaration
public Task ScrollToTimelineAsync(DateTime scrollDateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | scrollDateTime | The DateTime in the timeline to be focused. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method scrolls the timeline to the specified data and time. The task returned by this method will complete when the operation is complete.
Examples
<button @onclick="ScrollToTimeline">ScrollTimeline</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" ParentID="ParentId">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ScrollToTimeline()
{
await gantt.ScrollToTimelineAsync(new DateTime(2021, 12, 25)); /// pass the date here
}
}
SearchAsync(String)
Searches the Gantt chart records using the given key in dataset.
Declaration
public Task SearchAsync(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | A string value representing the key to be searched for in the dataset. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task object representing the asynchronous operation. |
Remarks
This method is asynchronous and should be awaited when called. It will search the dataset for the key provided and return the result. Searches the given key and displays only the rows which matches the key with any of its column values.
Examples
<button @onclick="Search">Search</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task Search()
{
await gantt.SearchAsync("id");
}
}
SelectCellAsync(ValueTuple<Int32, Int32>, Nullable<Boolean>)
Selects a cell based on the given index and toggle value.
Declaration
public Task SelectCellAsync(ValueTuple<int, int> cellIndex, Nullable<bool> isToggle = null)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<System.Int32, System.Int32> | cellIndex | A tuple representing the (row,column) index of the cell to be selected. |
System.Nullable<System.Boolean> | isToggle | A boolean value representing whether the cell should be toggled on or off. If null, the cell's current state will not be changed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task object representing the asynchronous operation. |
Remarks
This method is asynchronous and should be awaited when called. The method will select the cell at the provided index and toggle it on or off based on the provided value. If no value is provided for the toggle parameter, the cell's current state will not be changed. AllowSelection should be enabled.
Examples
<button @onclick="SelectCellFunc">Select Cell</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
Tuple<int,int> cellIndex=new Tuple<int,int>(1,2);
private async Task SelectCellFunc()
{
await gantt.SelectCellAsync(cellIndex,true);
}
}
SelectRowAsync(Int32, Boolean)
Selects a row by index and allows for toggling the selection.
Declaration
public Task SelectRowAsync(int index, bool isToggle = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the row to select |
System.Boolean | isToggle | Determines whether to toggle the selection of the row or not. Default is false. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous oepration. |
Remarks
This method selects a row based on the provided index and allows for toggling the selecting of the row. If the isToggle parameter is set to true, the method will toggle the selection of the row. If isToggle is set to false, the method will select the row. AllowSelection should be enabled.
Examples
<button @onclick="SelectRowFunc">Select Row</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SelectRowFunc()
{
await gantt.SelectRowAsync(2,true);
}
}
SelectRowsAsync(Int32[])
Selects multiple rows by their indexes.
Declaration
public Task SelectRowsAsync(int[] rowIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | rowIndexes | An arrray of the indexes of the rows to select |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
This method allows the selection of multiple rows by providing an array of row indexes. AllowSelection should be enabled.
Examples
<button @onclick="SelectRows">Select Rows</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SelectRows()
{
await gantt.SelectRowsAsync(new int[] {2,5});
}
}
SelectRowsByRangeAsync(Int32, Int32)
Select a range of rows within a specified range in Gantt Chart asynchronously.
Declaration
public Task SelectRowsByRangeAsync(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The row starting index to be selected. |
System.Int32 | endIndex | The Row ending index to be selected. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | The System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
AllowSelection should be enabled.
Examples
<button @onclick="SelectRowByRange">Select rows by Range</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SelectRowByRange()
{
await gantt.SelectRowsByRangeAsync(2,6);
}
}
SetPersistDataAsync(String)
Loads a already saved state of the Gantt chart asynchronously.
Declaration
public Task SetPersistDataAsync(string properties)
Parameters
Type | Name | Description |
---|---|---|
System.String | properties | Serialized gantt chart properties to apply to current state. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
Remarks
The persist data passed as a parameter should be stored in a secure location and encrypted if necessary. Ensure that the storage used in this method is reliable and can handle high read/write workloads. Users can view pre stored state easily in gantt chart. Current state can be stored using GetPersistDataAsync() method.
Examples
<button id="SetPersistence" @onclick="SetPersistence">Set Persistence</button>
<SfGantt @ref = "gantt" EnablePersistence=”true” DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private string currentState;
private async Task SetPersistence()
{
await gantt.SetPersistDataAsync(currentState);
}
}
SetSplitterPositionAsync(SplitterView)
Changes the splitter position dynamically to show only grid section or chart section or both sections.
Declaration
public Task SetSplitterPositionAsync(SplitterView positionValue)
Parameters
Type | Name | Description |
---|---|---|
SplitterView | positionValue | One of the SplitterView value. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method sets the splitter position using the provided SplitterView object. The position value must be a valid SplitterView object.
Examples
<button @onclick="SetSplitterPosition">Set Splitter Position</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SetSplitterPosition()
{
await gantt.SetSplitterPositionAsync(SplitterView.Grid);
}
}
SetSplitterPositionAsync(Int32)
Sets the splitter position to the end of a column asynchronously.
Declaration
public Task SetSplitterPositionAsync(int positionValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | positionValue | The position value to set the splitter to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method sets the splitter position using the provided position value. The position value must be an integer.
Examples
<button @onclick="SetSplitter">Set Splitter Position</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SetSplitter()
{
await gantt.SetSplitterPositionAsync(2);
}
}
SetSplitterPositionAsync(String)
Changes the splitter position dynamically based on position property.
Declaration
public Task SetSplitterPositionAsync(string positionValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | positionValue | Any value from 0 to 100 that denotes the perentage of total gantt width. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method sets the splitter position using the provided position value.
Examples
<button @onclick="SetSplitterPosition">Set Splitter position</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SetSplitterPosition()
{
await gantt.SetSplitterPositionAsync("0");
}
}
ShouldRender()
Declaration
protected override bool ShouldRender()
Returns
Type |
---|
System.Boolean |
ShowColumnAsync(String, String)
Asynchronously shows a column by its column name.
Declaration
public Task ShowColumnAsync(string key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The name of the column. |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchroous operation. |
Remarks
You can dynamically show hidden column. This method shows a column in the view using the provided key and hideBy value.
Examples
<button @onclick="ShowColumn">Show Column</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ShowColumn()
{
await gantt.ShowColumnAsync("TaskName","Name");
}
}
ShowColumnsAsync(String[], String)
Asynchronously shows multiple columns by its column names.
Declaration
public Task ShowColumnsAsync(string[] key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | key | An array of keys of the columns should be shown |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method shows multiple columns in the view using the provided keys and hideBy value. You can dynamically show hidden columns.
Examples
<button @onclick="ShowColumn">Show Columns</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ShowColumn()
{
await Gantt.ShowColumnsAsync(new string[] { "TaskName","TaskId"},"TaskDetails");
}
}
ShowSpinnerAsync()
Asynchronously shows the spinner in gantt chart whenever needed to indicate that a gantt chart action is in processing.
Declaration
public Task ShowSpinnerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method should be used when a long-running task is being executed and the user should be notified that the task is still in progress.
Examples
<button @onclick="ShowSpinner">Show Spinner</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ShowSpinner()
{
await gantt.ShowSpinnerAsync();
}
}
SortByColumnAsync(String, SortDirection, Nullable<Boolean>)
Asynchronously sorts the data by the specified column in the specified direction.
Declaration
public Task SortByColumnAsync(string columnName, SortDirection direction, Nullable<bool> isMultiSort = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | columnName | The field name to be sorted. |
SortDirection | direction | The sort direction SortDirection (ascending or descending). |
System.Nullable<System.Boolean> | isMultiSort | Indicates whether or not multiple column sorting is enabled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method should be used to sort the data displayed in a grid or table. AllowSorting should be enabled.
Examples
<button @onclick="SortByColumn">Sort by column</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task SortByColumn()
{
await Gantt.SortByColumnAsync("Id", SortDirection.Ascending,true);
}
}
SplitTaskAsync(Guid, List<DateTime>)
Splits a task by its ID Id with the specified split dates.
Declaration
public Task SplitTaskAsync(Guid id, List<DateTime> splitDates)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The ID of the task to split. Should be of type System.Guid. |
System.Collections.Generic.List<System.DateTime> | splitDates | The list of date where the task to be split. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method allows splitting a task by its ID with the provided list of split dates.
Examples
<button @onclick="SplitTaskFunc">Split Task</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void SplitTaskFunc()
{
await gantt.SplitTaskAsync(D1B8DCC4-C9F3-4E70-85F0-0FE7243F83C1, new List<DateTime> { new DateTime(03/02/2023) , new DateTime(03/06/2023) });
}
}
SplitTaskAsync(Int32, List<DateTime>)
Splits a task by its ID Id with the specified split dates.
Declaration
public Task SplitTaskAsync(int id, List<DateTime> splitDates)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ID of the task to split. Should be of type System.Int32. |
System.Collections.Generic.List<System.DateTime> | splitDates | The list of date where the task to be split. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method allows splitting a task by its ID with the provided list of split dates.
Examples
<button @onclick="SplitTaskFunc">Split Task</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void SplitTaskFunc()
{
await gantt.SplitTaskAsync(7, new List<DateTime> { new DateTime(03/02/2023) , new DateTime(03/06/2023) });
}
}
SplitTaskAsync(String, List<DateTime>)
Splits a task by its ID Id with the specified split dates.
Declaration
public Task SplitTaskAsync(string id, List<DateTime> splitDates)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the task to split. Should be of type System.String. |
System.Collections.Generic.List<System.DateTime> | splitDates | The list of date where the task to be split. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This method allows splitting a task by its ID with the provided list of split dates.
Examples
<button @onclick="SplitTaskFunc">Split Task</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void SplitTaskFunc()
{
await gantt.SplitTaskAsync("12", new List<DateTime> { new DateTime(03/02/2023) , new DateTime(03/06/2023) });
}
}
UpdateChildProperties(String, Object)
Incoming changedValues have been assigned to child properties.
Declaration
public void UpdateChildProperties(string key, object changedValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Specifies the Key. |
System.Object | changedValue | Specifies the changedValue. |
UpdatePredecessor(Guid, String)
Updates the dependency value of a task by the task id and predecessor string.
Declaration
public void UpdatePredecessor(Guid id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The task of value ‘Id’ property of Id class |
System.String | predecessorString | A string containing the updated predecessor information for the task. |
Remarks
The predecessor string should be formatted as a comma-seperated list of task ids with specific predecessor type.
Examples
<button @onclick="UpdatePredecessorHandler">Update Predecessor</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void updatePredecessorHandler()
{
gantt.UpdatePredecessor(“3F2504E0-4F89-11D3-9A0C-0305E82C3301”,”9245fe4a-d402-451c-b9ed-9c1a04247482 FS”); /// pass task id and predecessor type.
}
}
UpdatePredecessor(Int32, String)
Updates the dependency value of a task by the task id and the predecessor string.
Declaration
public void UpdatePredecessor(int id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The task value of |
System.String | predecessorString | A string containing the updated predecessor information for the task. |
Remarks
The predecessor string should be formatted as a comma-seperated list of task ids with specific predecessor type.
Examples
<button @onclick="UpdatePredecessorHandler">Update Predecessor</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async UpdatePredecessorHandler()
{
await gantt.UpdatePredecessor(7,"4FS");
}
}
UpdatePredecessor(String, String)
Updates the dependency value of a task by the task id and predecessor string.
Declaration
public void UpdatePredecessor(string id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task of value ‘Id’ property of Id class |
System.String | predecessorString | A string containing the updated predecessor information for the task. |
Remarks
The predecessor string should be formatted as a comma-seperated list of task ids, with specific predecessor type.
Examples
<button @onclick="UpdatePredecessorHandler">Update Predecessor</button>
<SfGantt @ref = "gantt" DataSource="@TaskCollection">
<GanttTaskFields Id = "TaskId" Name="TaskName" StartDate="StartDate" EndDate="EndDate"
Duration="Duration" Progress="Progress" Child="SubTasks">
</GanttTaskFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void updatePredecessorHandler()
{
gantt.UpdatePredecessor(“ABCD12”,”ABCS FS”); /// pass task id and predecessor type.
}
}
UpdateProjectDates(Nullable<DateTime>, Nullable<DateTime>)
Updates the project start date and end date of the project.
Declaration
public void UpdateProjectDates(Nullable<DateTime> startDate, Nullable<DateTime> endDate)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.DateTime> | startDate | The new start date of the project. |
System.Nullable<System.DateTime> | endDate | The new end date of the project. |
Remarks
The method updates the start and end dates of the project. If the start date is null, the original start date will be kept. If the end date is null, the original end date will be kept. If both are null, no updates will be made.
Examples
<button @onclick="UpdateProjectDatesFunc">Update Project Date</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private void UpdateProjectDatesFunc()
{
gantt.UpdateProjectDates(new DateTime(2021, 04, 02), new DateTime(2021, 05, 05));
}
}
UpdateRecordByIDAsync(TValue)
Updates a record in the data source asynchronously.
Declaration
public Task UpdateRecordByIDAsync(TValue data)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The updated record object. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method can be used to update a record in the data source asynchronously. The method will update the record without blocking the current thread. The task completes when the update operation is finished. The data paramemter should be a valid object of the type TValue. AllowEditing should be true.
Examples
<button @onclick="UpdateRecordFunc">Update Record By ID</button>
<SfGantt TValue="TaskData">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async UpdateRecordFunc()
{
TaskData data = new TaskData(30,"ProjectApproval",new DateTime(2022,04,01),new DateTime(2022,04,05),"5",56,29);
await gantt.UpdateRecordByIDAsync(data);
}
}
UpdateResourceAssignmentAsync<TAssignment>(TAssignment)
Updates an existing task resource assignment data based on the primary key value.
Declaration
public Task UpdateResourceAssignmentAsync<TAssignment>(TAssignment resourceAssignment)
Parameters
Type | Name | Description |
---|---|---|
TAssignment | resourceAssignment | The updated resource assignment data. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
TAssignment | The type of resource assignment data. |
Remarks
Use this method to modify the resource assignment data of an existing task resource assignment. The resourceAssignment
parameter should contain the necessary information such as the primary key, task ID, resource ID, and resource units.
The updation is based on the provided primary key. If any changes are made in your collection, they will be reflected in the modified existing resource assignment.
Examples
<button @onclick="UpdateResourceAssignmentFunc">Update ResourceAssignment</button>
<SfGantt<TaskData> @ref="gantt" DataSource="@TaskCollection">
<GanttAssignmentFields TValue="TaskData" TAssignment="ResourceAssignmentData" PrimaryKey="Id"TaskID="TaskId" ResourceID="ResourceId" Units="Unit" DataSource="@ResourceAssignmentCollection">
</GanttAssignmentFields>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
public async void UpdateResourceAssignmentFunc()
{
ResourceAssignmentData updatedResourceAssignment = new ResourceAssignmentData()
{
Id=3,
TaskId = 2,
ResourceId = 5,
Unit = 40
};
await gantt.UpdateResourceAssignmentAsync(updatedResourceAssignmen
}
}
ZoomInAsync()
Increases the zoom level of the current view of Gantt chart Component.
Declaration
public Task ZoomInAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method can be used to increase the zoom level of the current view in an asynchronous manner. The method will update the zoom level of the view without blocking the current thread. The task completes when the zoom operation in finished.
Examples
<button @onclick="ZoomIn">Zoom In</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async ZoomIn()
{
await gantt.ZoomInAsync();
}
}
ZoomOutAsync()
Decreases the zoom level of the current view asynchronously.
Declaration
public Task ZoomOutAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method can be used to decrease the zoom level of the current view in an asynchronous manner. The method will update the zoom level of the view without blocking the current thread. The task completes when the zoom operation is finished.
Examples
<button @onclick="ZoomOut">Zoom Out</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ZoomOut()
{
await gantt.ZoomOutAsync();
}
}
ZoomToFitAsync()
Asynchronously zooms the time line in Gantt Chart such that all the taskbars are visibile in single view port.
Declaration
public Task ZoomToFitAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Remarks
This method should be called after adding or removing features to ensure that all features are visible within the view.
Examples
<button @onclick="ZoomFitFunc">Zoom to Fit</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task ZoomFitFunc()
{
await gantt.ZoomToFitAsync();
}
}