QuickGrid<TGridItem> Class

Definition

A component that displays a grid.

[Microsoft.AspNetCore.Components.CascadingTypeParameter("TGridItem")]
public class QuickGrid<TGridItem> : Microsoft.AspNetCore.Components.ComponentBase, IAsyncDisposable
[<Microsoft.AspNetCore.Components.CascadingTypeParameter("TGridItem")>]
type QuickGrid<'GridItem> = class
    inherit ComponentBase
    interface IAsyncDisposable
Public Class QuickGrid(Of TGridItem)
Inherits ComponentBase
Implements IAsyncDisposable

Type Parameters

TGridItem

The type of data represented by each row in the grid.

Inheritance
QuickGrid<TGridItem>
Attributes
Implements

Constructors

QuickGrid<TGridItem>()

Constructs an instance of QuickGrid<TGridItem>.

Properties

AdditionalAttributes

Gets or sets a collection of additional attributes that will be applied to the created element.

ChildContent

Defines the child components of this instance. For example, you may define columns by adding components derived from the ColumnBase<TGridItem> base class.

Class

An optional CSS class name. If given, this will be included in the class attribute of the rendered table.

ItemKey

Optionally defines a value for @key on each rendered row. Typically this should be used to specify a unique identifier, such as a primary key value, for each data item.

This allows the grid to preserve the association between row elements and data items based on their unique identifiers, even when the TGridItem instances are replaced by new copies (for example, after a new query against the underlying data store).

If not set, the @key will be the TGridItem instance itself.

Items

A queryable source of data for the grid.

This could be in-memory data converted to queryable using the AsQueryable(IEnumerable) extension method, or an EntityFramework DataSet or an IQueryable derived from it.

You should supply either Items or ItemsProvider, but not both.

ItemSize

This is applicable only when using Virtualize. It defines an expected height in pixels for each row, allowing the virtualization mechanism to fetch the correct number of items to match the display size and to ensure accurate scrolling.

ItemsProvider

A callback that supplies data for the rid.

You should supply either Items or ItemsProvider, but not both.

Pagination

Optionally links this QuickGrid<TGridItem> instance with a PaginationState model, causing the grid to fetch and render only the current page of data.

This is normally used in conjunction with a Paginator component or some other UI logic that displays and updates the supplied PaginationState instance.

Theme

A theme name, with default value "default". This affects which styling rules match the table.

Virtualize

If true, the grid will be rendered with virtualization. This is normally used in conjunction with scrolling and causes the grid to fetch and render only the data around the current scroll viewport. This can greatly improve the performance when scrolling through large data sets.

If you use Virtualize, you should supply a value for ItemSize and must ensure that every row renders with the same constant height.

Generally it's preferable not to use Virtualize if the amount of data being rendered is small or if you are using pagination.

Methods

BuildRenderTree(RenderTreeBuilder)
DispatchExceptionAsync(Exception)

Treats the supplied exception as being thrown by this component. This will cause the enclosing ErrorBoundary to transition into a failed state. If there is no enclosing ErrorBoundary, it will be regarded as an exception from the enclosing renderer.

This is useful if an exception occurs outside the component lifecycle methods, but you wish to treat it the same as an exception from a component lifecycle method.

(Inherited from ComponentBase)
DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

InvokeAsync(Action)

Executes the supplied work item on the associated renderer's synchronization context.

(Inherited from ComponentBase)
InvokeAsync(Func<Task>)

Executes the supplied work item on the associated renderer's synchronization context.

(Inherited from ComponentBase)
OnAfterRender(Boolean)

Method invoked after each time the component has rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any ElementReference fields will be populated by the time this runs.

This method is not invoked during prerendering or server-side rendering, because those processes are not attached to any live browser DOM and are already complete before the DOM is updated.

(Inherited from ComponentBase)
OnAfterRenderAsync(Boolean)

Method invoked after each time the component has been rendered interactively and the UI has finished updating (for example, after elements have been added to the browser DOM). Any ElementReference fields will be populated by the time this runs.

This method is not invoked during prerendering or server-side rendering, because those processes are not attached to any live browser DOM and are already complete before the DOM is updated.

Note that the component does not automatically re-render after the completion of any returned Task, because that would cause an infinite render loop.

OnInitialized()

Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree.

(Inherited from ComponentBase)
OnInitializedAsync()

Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree.

Override this method if you will perform an asynchronous operation and want the component to refresh when that operation is completed.

(Inherited from ComponentBase)
OnParametersSet()

Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.

(Inherited from ComponentBase)
OnParametersSetAsync()

Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.

RefreshDataAsync()

Instructs the grid to re-fetch and render the current data from the supplied data source (either Items or ItemsProvider).

SetParametersAsync(ParameterView)

Sets parameters supplied by the component's parent in the render tree.

(Inherited from ComponentBase)
ShouldRender()

Returns a flag to indicate whether the component should render.

(Inherited from ComponentBase)
ShowColumnOptionsAsync(ColumnBase<TGridItem>)

Displays the ColumnOptions UI for the specified column, closing any other column options UI that was previously displayed.

SortByColumnAsync(ColumnBase<TGridItem>, SortDirection)

Sets the grid's current sort column to the specified column.

StateHasChanged()

Notifies the component that its state has changed. When applicable, this will cause the component to be re-rendered.

(Inherited from ComponentBase)

Explicit Interface Implementations

IComponent.Attach(RenderHandle) (Inherited from ComponentBase)
IHandleAfterRender.OnAfterRenderAsync() (Inherited from ComponentBase)
IHandleEvent.HandleEventAsync(EventCallbackWorkItem, Object) (Inherited from ComponentBase)

Applies to