Class
TelerikGrid<TItem>

The class for the Telerik Grid component.

Definition

Namespace:Telerik.Blazor.Components

Assembly:Telerik.Blazor.dll

Type Parameters:

TItem

The type of the model to which the grid is bound.

Syntax:

cs-api-definition
public class TelerikGrid<TItem> : TableGridBase<TItem, GridCommandEventArgs>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseBaseComponentDataBoundComponent<TItem>GridBase<TItem>TableGridBase<TItem, GridCommandEventArgs>TelerikGrid<TItem>

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members TableGridBase<TItem, GridCommandEventArgs>._selectedItemsMapTableGridBase<TItem, GridCommandEventArgs>.OnAfterRender(bool)TableGridBase<TItem, GridCommandEventArgs>.Dispose()TableGridBase<TItem, GridCommandEventArgs>.SetMultiColumnHeaders()TableGridBase<TItem, GridCommandEventArgs>.OnParametersSet()TableGridBase<TItem, GridCommandEventArgs>.HandleVirtualScrollPaging()TableGridBase<TItem, GridCommandEventArgs>.SetSkip(int)TableGridBase<TItem, GridCommandEventArgs>.ResetEditContext()TableGridBase<TItem, GridCommandEventArgs>.PageData()TableGridBase<TItem, GridCommandEventArgs>.GetItemFromDropIndex(string)TableGridBase<TItem, GridCommandEventArgs>.GetItemFromDropIndex(int)TableGridBase<TItem, GridCommandEventArgs>.DialogFactoryTableGridBase<TItem, GridCommandEventArgs>.IdTableGridBase<TItem, GridCommandEventArgs>.ColumnVirtualizationTableGridBase<TItem, GridCommandEventArgs>.AutoGenerateColumnsTableGridBase<TItem, GridCommandEventArgs>.NavigableTableGridBase<TItem, GridCommandEventArgs>.RowTemplateTableGridBase<TItem, GridCommandEventArgs>.NoDataTemplateTableGridBase<TItem, GridCommandEventArgs>.ResizableTableGridBase<TItem, GridCommandEventArgs>.ReorderableTableGridBase<TItem, GridCommandEventArgs>.SortableTableGridBase<TItem, GridCommandEventArgs>.SortModeTableGridBase<TItem, GridCommandEventArgs>.FilterMenuTypeTableGridBase<TItem, GridCommandEventArgs>.SelectedItemsTableGridBase<TItem, GridCommandEventArgs>.SelectedItemsChangedTableGridBase<TItem, GridCommandEventArgs>.EnableLoaderContainerTableGridBase<TItem, GridCommandEventArgs>.RowDraggableTableGridBase<TItem, GridCommandEventArgs>.ConfirmDeleteTableGridBase<TItem, GridCommandEventArgs>.RowHeightTableGridBase<TItem, GridCommandEventArgs>.FilterRowDebounceDelayTableGridBase<TItem, GridCommandEventArgs>.ShowColumnMenuTableGridBase<TItem, GridCommandEventArgs>.OnCreateTableGridBase<TItem, GridCommandEventArgs>.OnUpdateTableGridBase<TItem, GridCommandEventArgs>.OnDeleteTableGridBase<TItem, GridCommandEventArgs>.OnEditTableGridBase<TItem, GridCommandEventArgs>.OnAddTableGridBase<TItem, GridCommandEventArgs>.OnCancelGridBase<TItem>.WidthGridBase<TItem>.HeightGridBase<TItem>.PageSizeChangedGridBase<TItem>.PageSizeGridBase<TItem>.PageGridBase<TItem>.PageChangedGridBase<TItem>.PageableGridBase<TItem>.OnModelInitGridBase<TItem>.TotalCountDataBoundComponent<TItem>.Rebind()DataBoundComponent<TItem>.DataBaseComponent.ShouldRender()BaseComponent.OnInitializedAsync()BaseComponent.InitLocalizer()BaseComponent.ThrowIfParameterIsNull(object, string)BaseComponent.HaveOptionsChanged(IDictionary<string, object>, IDictionary<string, object>)BaseComponent.GetClassString(params string[])BaseComponent.InvokeAsync<T>(string, params object[])BaseComponent.InvokeAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidAsync(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidComponentMethodAsync(string, params object[])BaseComponent.InvokeComponentVoidMethodAsync(string, object)BaseComponent.InvokeDisposeAsync()BaseComponent.StateHasChanged()BaseComponent.RootComponentBaseComponent.ClassComponentBase.OnInitialized()ComponentBase.OnParametersSet()ComponentBase.OnAfterRender(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)

Constructors

TelerikGrid()

Declaration

cs-api-definition
public TelerikGrid()

Properties

DetailTemplate

Defines the detail template of the Grid for hierarchy scenarios.

Declaration

cs-api-definition
[Parameter]
public RenderFragment<TItem> DetailTemplate { get; set; }

Property Value

RenderFragment<TItem>

EditMode

Defines the EditMode of the Grid. Supports None, Inline, Popup and Incell editing. The default mode is None.

Declaration

cs-api-definition
[Parameter]
public GridEditMode EditMode { get; set; }

Property Value

GridEditMode

FilterMode

Defines if users can filter the Grid via header row or header menus. Supports FilterRow, FilterMenu and None (default).

Declaration

cs-api-definition
[Parameter]
public GridFilterMode FilterMode { get; set; }

Property Value

GridFilterMode

GridExport

Defines the container tag for the Grid export configuration.

Declaration

cs-api-definition
[Parameter]
public RenderFragment GridExport { get; set; }

Property Value

RenderFragment

GridPagerTemplate

Defines the template to be displayed instead of the default Pager.

Declaration

cs-api-definition
[Parameter]
public RenderFragment GridPagerTemplate { get; set; }

Property Value

RenderFragment

GridSettings

Defines the container tag for additional Grid settings. See GridPagerSettings, GridPopupEditSettings, GridRowDraggableSettings, GridSelectionSettings and GridValidationSettings.

Declaration

cs-api-definition
[Parameter]
public RenderFragment GridSettings { get; set; }

Property Value

RenderFragment

GridToolBarTemplate

Defines the toolbar template of the Grid.

Declaration

cs-api-definition
[Parameter]
public RenderFragment GridToolBarTemplate { get; set; }

Property Value

RenderFragment

Groupable

Defines if users can group and ungroup the Grid, and if the group panel above the column headers is visible. Programmatic grouping via SetStateAsync(GridState<TItem>) is always possible.

Declaration

cs-api-definition
[Parameter]
public bool Groupable { get; set; }

Property Value

bool

LoadGroupsOnDemand

Defines if groups will load on demand. When true, all groups will be initially collapsed. The default value is false.

Declaration

cs-api-definition
[Parameter]
public bool LoadGroupsOnDemand { get; set; }

Property Value

bool

OnRead

Fires when the Grid requires items from the data source. Use this to attach your own logic for sorting, filtering, grouping and paging. Once OnRead is attached, you must implement all such data source operations here. The Component will no longer perform them for you.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridReadEventArgs> OnRead { get; set; }

Property Value

EventCallback<GridReadEventArgs>

OnRowClick

Fires when the user clicks on a row, or presses Enter while a row is focused.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowClick { get; set; }

Property Value

EventCallback<GridRowClickEventArgs>

OnRowCollapse

Fires when the user collapses a row in hierarchy scenarios.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridRowCollapseEventArgs> OnRowCollapse { get; set; }

Property Value

EventCallback<GridRowCollapseEventArgs>

OnRowContextMenu

Fires when the user triggers a contextmenu event with click or context menu button.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowContextMenu { get; set; }

Property Value

EventCallback<GridRowClickEventArgs>

OnRowDoubleClick

Fires when the user double-clicks on a row.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowDoubleClick { get; set; }

Property Value

EventCallback<GridRowClickEventArgs>

OnRowDrop

Fires when the user drops a dragged Grid row. RowDraggable must be enabled.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridRowDropEventArgs<TItem>> OnRowDrop { get; set; }

Property Value

EventCallback<GridRowDropEventArgs<TItem>>

OnRowExpand

Fires when the user expands a row in hierarchy scenarios.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridRowExpandEventArgs> OnRowExpand { get; set; }

Property Value

EventCallback<GridRowExpandEventArgs>

OnRowRender

Fires each time a row is rendered. Use this to add custom CSS classes to the row based on the data item.

Declaration

cs-api-definition
[Parameter]
public Action<GridRowRenderEventArgs> OnRowRender { get; set; }

Property Value

Action<GridRowRenderEventArgs>

OnStateChanged

Fires on user interaction that causes changes in the GridState<TItem>.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridStateEventArgs<TItem>> OnStateChanged { get; set; }

Property Value

EventCallback<GridStateEventArgs<TItem>>

OnStateInit

Invoked when the Grid is initialized and state could be loaded. Useful when you'd like to persist changed on page reloads.

Declaration

cs-api-definition
[Parameter]
public EventCallback<GridStateEventArgs<TItem>> OnStateInit { get; set; }

Property Value

EventCallback<GridStateEventArgs<TItem>>

ScrollMode

Defines scrolling mode of the Grid. Possible values are Scrollable and Virtual.

Declaration

cs-api-definition
[Parameter]
public GridScrollMode ScrollMode { get; set; }

Property Value

GridScrollMode

SelectedCells

Defines the collection of selected cells. The parameter supports two-way binding. Also set SelectionMode.

Declaration

cs-api-definition
[Parameter]
public IEnumerable<GridSelectedCellDescriptor> SelectedCells { get; set; }

Property Value

IEnumerable<GridSelectedCellDescriptor>

SelectedCellsChanged

The event fires when users select or unselect cell.

Declaration

cs-api-definition
[Parameter]
public EventCallback<IEnumerable<GridSelectedCellDescriptor>> SelectedCellsChanged { get; set; }

Property Value

EventCallback<IEnumerable<GridSelectedCellDescriptor>>

SelectionMode

Defines the Selection Mode of the Grid.

Declaration

cs-api-definition
[Parameter]
public GridSelectionMode SelectionMode { get; set; }

Property Value

GridSelectionMode

Size

Specifies the density of the Grid data rows, including cell padding. Default value is Medium.

Declaration

cs-api-definition
[Parameter]
public string Size { get; set; }

Property Value

string

Methods

AutoFitAllColumnsAsync()

Sets the minimum possible widths to all Grid columns, so that there is no text wrapping.

Declaration

cs-api-definition
public Task AutoFitAllColumnsAsync()

Returns

Task

AutoFitColumnAsync(string)

Sets the minimum possible width to a Grid column, so that there is no text wrapping.

Declaration

cs-api-definition
public Task AutoFitColumnAsync(string id)

Parameters

id

string

The Id value of the column to autofit.

Returns

Task

AutoFitColumnsAsync(IEnumerable<string>)

Sets the minimum possible widths to multiple Grid columns, so that there is no text wrapping.

Declaration

cs-api-definition
public Task AutoFitColumnsAsync(IEnumerable<string> ids)

Parameters

ids

IEnumerable<string>

The Id values of the columns to autofit.

Returns

Task

BuildRenderTree(RenderTreeBuilder)

Declaration

cs-api-definition
protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder

RenderTreeBuilder

Overrides ComponentBase.BuildRenderTree(RenderTreeBuilder)

Dispose()

Declaration

cs-api-definition
public override void Dispose()

Overrides TableGridBase<TItem, GridCommandEventArgs>.Dispose()

ExportToCsvAsync()

Exports the Grid to a MemoryStream that can be saved as a CSV file.

Declaration

cs-api-definition
public Task<MemoryStream> ExportToCsvAsync()

Returns

Task<MemoryStream>

ExportToExcelAsync()

Exports the Grid to a MemoryStream that can be saved as an Excel file.

Declaration

cs-api-definition
public Task<MemoryStream> ExportToExcelAsync()

Returns

Task<MemoryStream>

GetItemFromDropIndex(int)

Declaration

cs-api-definition
protected override TItem GetItemFromDropIndex(int index)

Parameters

index

int

Returns

TItem

Overrides TableGridBase<TItem, GridCommandEventArgs>.GetItemFromDropIndex(int)

GetState()

Gets the current state of the Grid. Includes grouping, filtering, edit items, column state, etc.

Declaration

cs-api-definition
public GridState<TItem> GetState()

Returns

GridState<TItem>

Instance of a GridState<TItem> class that contains all data.

OnAfterRenderAsync(bool)

Declaration

cs-api-definition
protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender

bool

Returns

Task

Overrides BaseComponent.OnAfterRenderAsync(bool)

OnParametersSetAsync()

Declaration

cs-api-definition
protected override Task OnParametersSetAsync()

Returns

Task

Overrides DataBoundComponent<TItem>.OnParametersSetAsync()

PageData()

Declaration

cs-api-definition
protected override Task PageData()

Returns

Task

Overrides TableGridBase<TItem, GridCommandEventArgs>.PageData()

SaveAsCsvFileAsync()

Exports the Grid to a file and sends it to the browser for download.

Declaration

cs-api-definition
public ValueTask SaveAsCsvFileAsync()

Returns

ValueTask

SaveAsExcelFileAsync()

Exports the grid to a file and sends it to the browser for download.

Declaration

cs-api-definition
public ValueTask SaveAsExcelFileAsync()

Returns

ValueTask

SetParametersAsync(ParameterView)

Declaration

cs-api-definition
public override Task SetParametersAsync(ParameterView parameters)

Parameters

parameters

ParameterView

Returns

Task

Overrides DataBoundComponent<TItem>.SetParametersAsync(ParameterView)

SetSkip(int)

Declaration

cs-api-definition
protected override void SetSkip(int skip)

Parameters

skip

int

Overrides TableGridBase<TItem, GridCommandEventArgs>.SetSkip(int)

SetStateAsync(GridState<TItem>)

Changes the state of the Grid. Includes all properties, which are controlled by the user - grouping, filtering, edit items, column state, etc.

Declaration

cs-api-definition
public Task SetStateAsync(GridState<TItem> state)

Parameters

state

GridState<TItem>

Returns

Task