ClassTelerikGrid<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:
public class TelerikGrid<TItem> : TableGridBase<TItem, GridCommandEventArgs>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Inheritance: objectComponentBaseBaseComponentDataBoundComponent<TItem>GridBase<TItem>TableGridBase<TItem, GridCommandEventArgs>TelerikGrid<TItem>
Implements:
Inherited Members
Constructors
TelerikGrid()
Declaration
public TelerikGrid()
Properties
DetailTemplate
Defines the detail template of the Grid for hierarchy scenarios.
Declaration
[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
[Parameter]
public GridEditMode EditMode { get; set; }
Property Value
FilterMode
Defines if users can filter the Grid via header row or header menus. Supports FilterRow, FilterMenu and None (default).
Declaration
[Parameter]
public GridFilterMode FilterMode { get; set; }
Property Value
GridExport
Defines the container tag for the Grid export configuration.
Declaration
[Parameter]
public RenderFragment GridExport { get; set; }
Property Value
GridPagerTemplate
Defines the template to be displayed instead of the default Pager.
Declaration
[Parameter]
public RenderFragment GridPagerTemplate { get; set; }
Property Value
GridSettings
Defines the container tag for additional Grid settings. See GridPagerSettings, GridPopupEditSettings, GridRowDraggableSettings, GridSelectionSettings and GridValidationSettings.
Declaration
[Parameter]
public RenderFragment GridSettings { get; set; }
Property Value
GridToolBarTemplate
Defines the toolbar template of the Grid.
Declaration
[Parameter]
public RenderFragment GridToolBarTemplate { get; set; }
Property Value
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.
LoadGroupsOnDemand
Defines if groups will load on demand. When true
, all groups will be initially collapsed.
The default value is false
.
Declaration
[Parameter]
public bool LoadGroupsOnDemand { get; set; }
Property Value
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
[Parameter]
public EventCallback<GridReadEventArgs> OnRead { get; set; }
Property Value
OnRowClick
Fires when the user clicks on a row, or presses Enter while a row is focused.
Declaration
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowClick { get; set; }
Property Value
OnRowCollapse
Fires when the user collapses a row in hierarchy scenarios.
Declaration
[Parameter]
public EventCallback<GridRowCollapseEventArgs> OnRowCollapse { get; set; }
Property Value
OnRowContextMenu
Fires when the user triggers a contextmenu event with click or context menu button.
Declaration
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowContextMenu { get; set; }
Property Value
OnRowDoubleClick
Fires when the user double-clicks on a row.
Declaration
[Parameter]
public EventCallback<GridRowClickEventArgs> OnRowDoubleClick { get; set; }
Property Value
OnRowDrop
Fires when the user drops a dragged Grid row. RowDraggable must be enabled.
Declaration
[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
[Parameter]
public EventCallback<GridRowExpandEventArgs> OnRowExpand { get; set; }
Property Value
OnRowRender
Fires each time a row is rendered. Use this to add custom CSS classes to the row based on the data item.
Declaration
[Parameter]
public Action<GridRowRenderEventArgs> OnRowRender { get; set; }
Property Value
OnStateChanged
Fires on user interaction that causes changes in the GridState<TItem>.
Declaration
[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
[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
[Parameter]
public GridScrollMode ScrollMode { get; set; }
Property Value
SelectedCells
Defines the collection of selected cells. The parameter supports two-way binding. Also set SelectionMode
.
Declaration
[Parameter]
public IEnumerable<GridSelectedCellDescriptor> SelectedCells { get; set; }
Property Value
SelectedCellsChanged
The event fires when users select or unselect cell.
Declaration
[Parameter]
public EventCallback<IEnumerable<GridSelectedCellDescriptor>> SelectedCellsChanged { get; set; }
Property Value
SelectionMode
Defines the Selection Mode of the Grid.
Declaration
[Parameter]
public GridSelectionMode SelectionMode { get; set; }
Property Value
Methods
AutoFitAllColumnsAsync()
Sets the minimum possible widths to all Grid columns, so that there is no text wrapping.
AutoFitColumnAsync(string)
Sets the minimum possible width to a Grid column, so that there is no text wrapping.
AutoFitColumnsAsync(IEnumerable<string>)
Sets the minimum possible widths to multiple Grid columns, so that there is no text wrapping.
Declaration
public Task AutoFitColumnsAsync(IEnumerable<string> ids)
Parameters
ids
The Id values of the columns to autofit.
Returns
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
Overrides
Dispose()
Declaration
public override void Dispose()
Overrides
ExportToCsvAsync()
Exports the Grid to a MemoryStream that can be saved as a CSV file.
Declaration
public Task<MemoryStream> ExportToCsvAsync()
Returns
ExportToExcelAsync()
Exports the Grid to a MemoryStream that can be saved as an Excel file.
Declaration
public Task<MemoryStream> ExportToExcelAsync()
Returns
GetItemFromDropIndex(int)
Declaration
protected override TItem GetItemFromDropIndex(int index)
Parameters
index
Returns
TItem
Overrides
GetState()
Gets the current state of the Grid. Includes grouping, filtering, edit items, column state, etc.
SaveAsCsvFileAsync()
Exports the Grid to a file and sends it to the browser for download.
SaveAsExcelFileAsync()
Exports the grid to a file and sends it to the browser for download.
SetParametersAsync(ParameterView)
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
parameters
Returns
Overrides
SetSkip(int)
Declaration
protected override void SetSkip(int skip)
Parameters
skip
Overrides
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.