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 the details of tab sections inside dialog for adding new record and also the column fields of Grid inside tab section.
Declaration
public List<GanttAddDialogField> AddDialogFields { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttAddDialogField> | A List instance of GanttAddDialogField. |
Remarks
Types of the tab which contains editor for columns are, General: Tab for populating valuues fo gantt columns of new record. Dependency: Tab for dependency edit. Resources: Tab for resources edit. Notes: Tab for notes edit.
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 whether to allow exporting Gantt data to excel and csv.
Declaration
public bool AllowExcelExport { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true If need to allow exporting to excel and csv; otherwise, false.The default value is false. |
Remarks
Exporting can be customized using ExcelExportProperties type parameter of ExportToCsvAsync() method.
AllowFiltering
Gets or sets whether to allow filtering.
Declaration
public bool AllowFiltering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true If need to allow Filtering; otherwise, false.The default value is false. |
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 | true if need to enable AllowMultiSorting; otherwise, false.The default value is true. |
AllowReordering
Gets or sets whether to allow reordering of Gantt columns.
Declaration
public bool AllowReordering { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true If need to allow reordering of columns; otherwise, false.The default value is false. |
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 | true If need to allow resizing of columns; otherwise, false.The default value is false. |
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 | true If need to allow row drag and drop in Gantt; otherwise, false.The default value is false. |
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 | true If need to allow selection of Gantt Record; otherwise, false. The default value is true. |
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 | true If need to allow sorting of records; otherwise, false.The default value is false. |
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 | true If need to render unscheduled tasks in gantt; otherwise, false. The default value is false. |
Remarks
You can create or update the tasks with anyone of start date, end date, and duration values or none.
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 | false to skip the auto calculation of scheduling dates; otherwise, true. By default, the property value is true. |
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 | Color name, for example "Orange" or its hex value. |
ChildContent
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment |
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 | true if root tasks are rendered in collapsed state; otherwise, false.The default value is false. |
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
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
Displays values of fields from the records of 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 for connector line.
Declaration
public string ConnectorLineBackground { get; set; }
Property Value
Type | Description |
---|---|
System.String | Color name, for example "Red" or its hex value. |
ConnectorLineWidth
Gets or sets the width of the connector line.
Declaration
public int ConnectorLineWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Pixel value in number. The default connector line width is 1. |
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
Defines how to copy 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
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.
CurrentViewData
Declaration
public IEnumerable<object> CurrentViewData { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> |
CustomZoomingLevels
Gets or sets an instance of CustomZoomingLevels to configure the zooming levels.
Declaration
public GanttZoomTimelineSettings[] CustomZoomingLevels { get; set; }
Property Value
Type | Description |
---|---|
GanttZoomTimelineSettings[] | An instance of CustomZoomingLevels. |
Remarks
CustomZoomingLevels class provides the various properties to custom 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>> |
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 format of date values in Gantt.
Declaration
public string DateFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String | Date format for example "MM/dd/YYYY". The default format is based on the culture. |
DayWorkingTime
Gets or sets an instance of GanttDayWorkingTime which decides the working time of a project.
Declaration
public List<GanttDayWorkingTime> DayWorkingTime { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttDayWorkingTime> | A List instance of GanttDayWorkingTime. |
Remarks
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.
Declaration
public List<DependencyType> DependencyTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<DependencyType> | A List instance of DependencyType. |
Remarks
Configured specific dependency types only are allowed for dependency mapping between multiple tasks in Gantt Chart. The type mentioned 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 | true If need to disable html encode; otherwise, false.The default value is false. |
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.
Declaration
public DurationUnit DurationUnit { get; set; }
Property Value
Type | Description |
---|---|
DurationUnit | 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 the details of tab sections inside dialog for editing a record and also the column fields of Grid inside tab section.
Declaration
public List<GanttEditDialogField> EditDialogFields { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttEditDialogField> | A List instance of GanttEditDialogField. |
Remarks
Types of the tab which contains editor for columns are, General: Tab for populating valuues fo gantt columns of new record. Dependency: Tab for dependency edit. Resources: Tab for resources edit. Notes: Tab for notes edit.
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
};
}
EnableColumnVirtualization
Gets or sets whether to enable virtual loading of column cells.
Declaration
public bool EnableColumnVirtualization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if need to enable column virtualization; otherwise, false. The default value is false. |
Remarks
Loads large dataset of columns in grid part of Gantt with better performance. Initially, renders only the columns that are in current viewport and load subsequent columns on horizontal scrolling.
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 | true if need to enable all built-in Context menu items; otherwise, false.The default value is false. |
Remarks
You can customize the context menu actions through ContextMenuOpen and ContextMenuItemClicked event handlers.
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 | true If need to persist Gantt state, otherwise, false. The default value is false. |
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.
EnablePredecessorValidation
Gets or sets whether to validate the predecessor.
Declaration
public bool EnablePredecessorValidation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if need to enable predecessor validation; otherwise, false. The default value is true. |
Remarks
You can perform custom validations through OnActionBegin event handler.
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 | true if need to enable rendering component in right to left direction; otherwise, false. The default value is false. |
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 | true if need to enable virtualization; otherwise, false.The default value is false. |
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.
EventMarkers
Gets or sets an instance of GanttEventMarker collection which configures the the events displayed in Gantt Chart.
Declaration
public List<GanttEventMarker> EventMarkers { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttEventMarker> | A List instance of GanttEventMarker. |
Remarks
GanttEventMarker class provides various properties to customize event markers in 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 GanttFilterSettings which configures filter action in Gannt Chart.
Declaration
public GanttFilterSettings FilterSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttFilterSettings | An instance of GanttFilterSettings. |
Remarks
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 | Description |
---|---|
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 yncfusion.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.
Height
Gets or sets the height of the Gantt component container.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | The Gantt Chart height in 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 | true if need to enable the weekend highlights; otherwise, false.The default value is fasle. |
Holidays
Gets or sets an instance of GanttHoliday collection in Gantt chart to display holidays in Gantt Chart.
Declaration
public List<GanttHoliday> Holidays { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GanttHoliday> | A List instance of GanttHoliday. |
Remarks
GanttHoliday class provides various properties to customize the appearance of holidays.
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". |
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 | true if need to include weekend as working days; otherwise, false.The default value is false. |
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
LabelSettings class provides the various properties of the gantt label setting.
LoadChildOnDemand
Gets or sets whether to load child record on demand in remote data binding. Initially parent records are rendered in collapsed state.
Declaration
public bool LoadChildOnDemand { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true If need to load only parent records at initial load, otherwise, false. The default value is false. |
Remarks
Boosts the performance of component by loading data on-demand.
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" |
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> | Project end date value in DateTime. The default value is null. |
ProjectStartDate
Gets or sets the start date of the project.
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. |
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
Query class provides various options for doing data operations in Gantt Chart.
RenderBaseline
Gets or sets whether to render of baseline in Gantt.
Declaration
public bool RenderBaseline { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if need to render the baseline in gantt; otherwise, false.The default value is true. |
Remarks
If 'RenderBaseline' is set to true, it allows rendering of baseline. The baseline start and end date values should be mapped from data source.
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
GanttResourceFields<TResources> class provides various properties to customizes the resource allocations.
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 | HtmlElement row height in pixel. The default value is 36 pixel. |
Remarks
Row height can be changed by using 'RowHeight' property.
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 | true, if taskbar is brought into view on row selection by horizontally scrolling the chart timeline.The default value is false |
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
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.
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.
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 | true if need to enable the column chooser; otherwise, false.The default value is false. |
Remarks
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 | true if need to enable column menu; otherwise, false.The default value is false. |
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.
ShowInlineNotes
Gets or sets whether to show notes column value inside the cell or in tooltip.
Declaration
public bool ShowInlineNotes { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if need to enable ShowInlineNotes; otherwise, false.The default value is true. |
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
SortSettings class provides the properties to customize the sort action.
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 taskbar height of Gantt.
Declaration
public Nullable<int> TaskbarHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | Taskbar HtmlElement height in pixel. |
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
Defined how to validate the task values in Gantt.
Declaration
public ScheduleMode TaskMode { get; set; }
Property Value
Type | Description |
---|---|
ScheduleMode | The available scheduling mode are,
|
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,
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
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
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
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 Gantt.
Declaration
public GanttTooltipSettings<TValue> TooltipSettings { get; set; }
Property Value
Type | Description |
---|---|
GanttTooltipSettings<TValue> | An instance of TooltipSettings. |
Remarks
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. |
Remarks
Tree column index can be changed by using 'TreeColumnIndex' property.
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 | true if need to validate manual tasks on linking; otherwise, false.The default value is false. |
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
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[] | Names of Weekdays. The dafault value is "Monday, Tuesday, Wednesday, Thursday, Friday. |
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
ZoomTimelineSettings class provides an properties to customize the zoomtimeline action.
Methods
AddPredecessor(Guid, String)
Adds 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 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 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<Double>, Nullable<RowPosition>)
Inserts a new record into gantt chart at particular row index.
Declaration
public Task AddRecordAsync(TValue data, Nullable<double> index = null, Nullable<RowPosition> position = null)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The new record to be added. |
System.Nullable<System.Double> | 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. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
When index and position parameter is 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">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task AddItemFunc()
{
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);
}
}
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 | Description |
---|---|
System.Threading.Tasks.Task |
CancelEdit()
Cancels the active edit state in the Gantt.
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 the filter from all columns in Gantt.
Declaration
public Task ClearFilteringAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
Clears the filtered rows of Gantt.
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()
Deselects all the selected rows and cells in Gantt.
Declaration
public Task ClearSelectionAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
Currently selected rows and cells in Gantt are cleared.
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()
Clear sorting from all the columns of the gantt.
Declaration
public Task ClearSortingAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
Clear all the sorted columns in Gantt.
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.
Declaration
public Task CollapseAllAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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(Double)
Collapses the records along with its child records, at specific hierarchical level.
Declaration
public Task CollapseAtLevelAsync(double level)
Parameters
Type | Name | Description |
---|---|---|
System.Double | level | The level of the record until which the rows to be Collapsed. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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.
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 | System.Threading.Tasks.Task. |
Remarks
Collapse a record based on the primary key value of the record.
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.
Declaration
public void ConvertToMilestone(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task value of |
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 | Decides whether to copy the record values along with header names. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
Remarks
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.
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. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
When the parameters are not passed, the selected record will be deleted. 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.
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 | System.Threading.Tasks.Task. |
Remarks
When the parameters are not passed, the selected record will be deleted. 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.
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. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
When the parameters are not passed, the selected record will be deleted. 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.
}
}
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 |
System.Boolean | isEnable | Decides whether to enable or disable items |
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.
Declaration
public Task ExpandAllAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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(Double)
Expands the records along with its parent at specific hierarchical level.
Declaration
public Task ExpandAtLevelAsync(double level)
Parameters
Type | Name | Description |
---|---|---|
System.Double | level | The hierarchical level until which the rows to be Expanded. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task. |
Remarks
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 based on 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 | System.Threading.Tasks.Task. |
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 data to CSV formal excel file.
Declaration
public Task ExportToCsvAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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 data to CSV format excel file.
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 | System.Threading.Tasks.Task. |
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 data to Excel file.
Declaration
public Task ExportToExcelAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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)
Exports the Gantt data to Excel file.
Declaration
public Task ExportToExcelAsync(ExcelExportProperties excelExportProperties)
Parameters
Type | Name | Description |
---|---|---|
ExcelExportProperties | excelExportProperties | The options for customizing the excel document during export. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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);
}
}
}
FilterByColumnAsync(String, String, String)
Filters the gantt data with column details.
Declaration
public Task FilterByColumnAsync(string fieldName, string filterOperator, string filterValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | The column name by which the data to be filtered. |
System.String | filterOperator | Operator in string, |
System.String | filterValue | The filter value. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Examples
<button @onclick="FilterByColumnFunc">Filter By Column</button>
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task FilterByColumnFunc()
{
await gantt.FilterByColumnAsync("TaskName","Startswith","Iden");
}
}
GetColumnIndexByFieldAsync(String)
Returns then index of a particular column from the gantt column collections.
Declaration
public Task<double> GetColumnIndexByFieldAsync(string field)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | The field name of the column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Double> | System.Threading.Tasks.Task. |
Examples
<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>> | System.Threading.Tasks.Task. |
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();
}
}
GetCurrentViewRecords()
Returns the currently visible records in GanttChart. 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
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()
Returns all filtered records 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>> | System.Threading.Tasks.Task. |
Remarks
Helps to obtain the filtered data after filtering in Gantt Chart.
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.GetFileredRecordsAsync();
}
}
GetHierarchicalData(Int32)
Returns the hierarchy relation properties of tasks.
Declaration
public ExpandoObject GetHierarchicalData(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The Id of Task. |
Returns
Type | Description |
---|---|
System.Dynamic.ExpandoObject | System.Dynamic.ExpandoObject. |
Remarks
Shows the hierarchical relation properties of the tasks in the Gantt 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> | System.Threading.Tasks.Task. |
Remarks
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 data source.
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> |
GetSelectedRecordsAsync()
Returns the collections of selected records in Gantt.
Declaration
public Task<List<TValue>> GetSelectedRecordsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<TValue>> | System.Threading.Tasks.Task. |
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()
Returns the collection of indexes of selected row and cells .
Declaration
public Task<List<ValueTuple<double, double>>> GetSelectedRowCellIndexesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<System.ValueTuple<System.Double, System.Double>>> | System.Threading.Tasks.Task. |
Remarks
Using this method, selected cell or row data can be obtained for any custom actions on selected data.
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<double>> GetSelectedRowIndexesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<System.Double>> | System.Threading.Tasks.Task. |
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();
}
}
HideColumnAsync(String, String)
Hides a column by column name.
Declaration
public Task HideColumnAsync(string key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The column name. |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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("TaskId","Id");
}
}
HideColumnsAsync(String[], String)
Hides columns by column names.
Declaration
public Task HideColumnsAsync(string[] key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | key | Collection of column names. |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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 in Gantt Chart whenever needed.
Declaration
public Task HideSpinnerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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 | System.Threading.Tasks.Task. |
Examples
<button @onclick="IndentFunc">Indent</button>
<SfGantt @ref="gantt" DataSource="@TaskCollection">
</SfGantt>
@code{
private SfGantt<TaskData> gantt;
private async Task IndentFunc()
{
await gantt.IndentAsync();
}
}
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
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 | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
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 | Description |
---|---|
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.
Declaration
public Task OpenAddDialogAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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 position in screen. |
System.Nullable<System.Double> | y | The Y position in screen. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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)
Opens a dialog to edit a task.
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 | System.Threading.Tasks.Task. |
Remarks
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.
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 | System.Threading.Tasks.Task. |
Remarks
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 a dialog to edit a task.
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 | System.Threading.Tasks.Task. |
Remarks
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 | System.Threading.Tasks.Task. |
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 component re-render.
Declaration
public void PreventRender(bool preventRender = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | preventRender | Default value is true. Toggles the ShouldRender method value. |
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()
Updates the timeline at start point with one unit.
Declaration
public void PreviousTimeSpan()
Remarks
Extends timeline with the one unit before the timeline start date.
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 Gantt Chart component.
Declaration
public Task RefreshAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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 with columns changes, if any.
Declaration
public Task RefreshColumnsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
Refresh the Gantt columns when column property values are updated externally.
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)
Remove dependencies from a task.
Declaration
public void RemovePredecessor(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The task of value ‘Id’ property of Id class |
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)
Remove a dependencies from a task.
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)
Remove dependencies from a task.
Declaration
public void RemovePredecessor(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The task of value ‘Id’ property of Id class |
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.
Declaration
public Task ReorderColumnsAsync(List<string> fromFName, string toFName)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.String> | fromFName | The list of field names to be moved together. |
System.String | toFName | The field name of the destination column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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(Double, Double, String)
Reorders the rows based on given indexes and positions.
Declaration
public Task ReorderRowAsync(double fromIndexes, double toIndex, string position)
Parameters
Type | Name | Description |
---|---|---|
System.Double | fromIndexes | The row index from which the row needs to be moved. |
System.Double | toIndex | Th 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
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 | System.Threading.Tasks.Task. |
Remarks
Applicable when State Persistence feature is enabled in gantt chart.
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();
}
}
ScrollIntoViewAsync(Int32, Int32)
Scrolls to 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 column index to scroll horizontally |
System.Int32 | rowIndex | The row index to scroll vertically |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task |
Remarks
Programmatically scrolls to view particular data in grid part of Gantt.
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 | System.Threading.Tasks.Task. |
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 | System.Threading.Tasks.Task. |
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.
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 | System.Threading.Tasks.Task. |
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.
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 | System.Threading.Tasks.Task. |
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 records using the given key.
Declaration
public Task SearchAsync(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The search key. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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 by the given indexes.
Declaration
public Task SelectCellAsync(ValueTuple<int, int> cellIndex, Nullable<bool> isToggle = null)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<System.Int32, System.Int32> | cellIndex | The ValueTuple of row and cell index to be selected. |
System.Nullable<System.Boolean> | isToggle | Decides whether to toggle the selection. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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(Double, Boolean)
Selects a row by the given index.
Declaration
public Task SelectRowAsync(double index, bool isToggle = false)
Parameters
Type | Name | Description |
---|---|---|
System.Double | index | The row index to be selected. |
System.Boolean | isToggle | Decides whether to toggle the selection. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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(Double[])
Select a collection of rows by indexes.
Declaration
public Task SelectRowsAsync(double[] rowIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | rowIndexes | The indexes of rows to be selected. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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 double[] {2,5});
}
}
SelectRowsByRangeAsync(Int32, Int32)
Select a range of rows in Gantt Chart.
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 | System.Threading.Tasks.Task. |
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.
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 | System.Threading.Tasks.Task. |
Remarks
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 | System.Threading.Tasks.Task. |
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.
Declaration
public Task SetSplitterPositionAsync(int positionValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | positionValue | The column index. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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 | System.Threading.Tasks.Task. |
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 | Description |
---|---|
System.Boolean |
ShowColumnAsync(String, String)
Shows a column by its column name.
Declaration
public Task ShowColumnAsync(string key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The column name. |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
You can dynamically show hidden column.
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)
Shows columns by its column names.
Declaration
public Task ShowColumnsAsync(string[] key, string hideBy)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | key | The column name. |
System.String | hideBy | Specifies whether the column name is based on Field or HeaderText property of column. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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()
Shows the spinner in gantt chart whenever needed to indicate that a gantt action is in processing.
Declaration
public Task ShowSpinnerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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>)
Sorts a column with the column details.
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 | One of the values of SortDirection. |
System.Nullable<System.Boolean> | isMultiSort | Decides whether to do multi-sorting. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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);
}
}
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.
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 | The predecessor string 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.
Declaration
public void UpdatePredecessor(int id, string predecessorString)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The task value of |
System.String | predecessorString | The predecessor string 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.
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 | The predecessor string 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.
Declaration
public void UpdateProjectDates(Nullable<DateTime> startDate, Nullable<DateTime> endDate)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.DateTime> | startDate | The start date of the project. |
System.Nullable<System.DateTime> | endDate | The end date of the project. |
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's value.
Declaration
public Task UpdateRecordByIDAsync(TValue data)
Parameters
Type | Name | Description |
---|---|---|
TValue | data | The updated record object. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
Remarks
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);
}
}
ZoomInAsync()
Zoom-in the timeline of Gantt.
Declaration
public Task ZoomInAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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()
Zoom-out the timeline of Gantt.
Declaration
public Task ZoomOutAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | System.Threading.Tasks.Task. |
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()
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 | System.Threading.Tasks.Task. |
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();
}
}