# FlexCore documentation > FlexCore is a Blazor UI component library for .NET 10: a virtualized data grid, tree grid, pivot table, charts, scheduler, Gantt, diagram and a report writer among 130+ controls, written in C# and rendered as HTML and SVG, with no npm packages. Install: `dotnet add package FlexCore`. The NuGet package is MIT licensed. The demos on this site run FlexCore 0.2.50; the NuGet listing can trail it by a release, so check nuget.org for the current version. FlexCore.Documents (PdfViewerControl, SpreadsheetControl) is a second package that is not yet on NuGet; it builds from the GitHub repository. Namespaces: the controls live in Fx.ControlKit and its sub-namespaces: .Grid (data grid, tree grid, pivot table, drop-down grid), .Charts, .Layout, .Navigation, .Dialogs, .Notifications, .Maps, .Scheduling, .Gantt, .Diagram, .Editor, .Data, .Docking, .Reports and .AI; Fx.ControlKit.Pdf comes with FlexCore.Documents. Every code example on the site starts with the @using lines it needs, so it compiles when copied into a new project. Runtime: ASP.NET Core Blazor on .NET 10; this site is Blazor Server with prerendering. The controls render HTML and inline SVG from C#. A few of them (dialog, splitter, editor, text box, the grid's scroll-position reader) ship small scripts of their own inside the package; there is no npm package and no bundler step. Services: register NotificationService (toasts), DialogService and IDialogService (confirm, alert, prompt) and, optionally, ZoomService. The report writer takes its data access from the host through IReportDataExecutor, IReportSessionContext, IReportPickListProvider and, for native .rpt files, IReportExporter. Sample data: 4,009 airports with scheduled service from OurAirports (public domain), invented businesses (a travel company called Razor Sharp Getaways, a warehouse, a web agency and a help desk) whose companies, people and addresses are all made up, and COVID-19 and ILO unemployment figures on the chart pages. This file is generated from the pages of https://flexcoreui.com: each section is one page, with its documentation tables and the code of its examples. Library version 0.2.50. The short index is https://flexcoreui.com/llms.txt. --- # FlexCore: the Blazor toolbox that gets data right. URL: https://flexcoreui.com/ Section: Start here Keywords: Blazor component library, Blazor UI components, Blazor controls, .NET 10 Blazor UI components for data-heavy .NET apps: data grid, charts, scheduler, Gantt and report writer among 130+ controls written in C#. --- # Get Started with FlexCore — Blazor Components for .NET 10 URL: https://flexcoreui.com/get-started Section: Start here Keywords: install, getting started, NuGet, _Imports.razor, Program.cs Install FlexCore from NuGet, add the Fx.ControlKit namespaces, register the dialog and toast services and put a first grid on a Blazor page; MIT license. --- # FlexCore Quick Start: a Blazor App to Download and Run URL: https://flexcoreui.com/quick-start Section: Start here Keywords: quick start, sample app, Blazor sample project, download, dotnet run Download Razor Sharp Getaways, a complete five-page Blazor app built with FlexCore, run it with dotnet run and borrow its grid, charts, scheduler and reports. --- # All Blazor Components URL: https://flexcoreui.com/components Section: Start here Keywords: component list, control catalog, Blazor components Find the right Blazor control for the job: FlexCore's controls in 13 groups, from data grid and charts to pickers and dialogs, each with a live demo. --- # FlexCore Community Edition: Sign up or Ask a Question URL: https://flexcoreui.com/signup Section: Start here Controls: FormControl, FormItemControl Keywords: Community edition, contact, sign up Leave an email to get the FlexCore Community edition link when it ships, or ask a question; a person answers, usually within two working days. --- # FlexCore FAQ: .NET Support, Grid, Reports, Comparisons URL: https://flexcoreui.com/faq Section: Start here Keywords: FAQ, Blazor Server, WebAssembly, QuickGrid, Crystal Reports Answers for teams evaluating FlexCore for Blazor: .NET 10 and render modes, JavaScript use, grid scale, Crystal Reports, support and comparisons. --- # Blazor Data Grid (DataGrid, Table) URL: https://flexcoreui.com/demo/grid Section: Data Grid Controls: GridControl, GridColumn, GridColumnsBase Keywords: datagrid, data grid, grid, data table, datatable, Blazor grid A Blazor data grid users can search, sort, filter, group and freeze, with only the visible rows rendered; try it on 4,009 real airports. ## Documentation ### Data | Name | Type | Default | Description | |---|---|---|---| | DataSource | IEnumerable? | null | The rows to show, enumerated for display, filtering, sorting and export. Cannot be set together with ItemsProvider. | | ChildContent | RenderFragment? | null | Holds the column definitions. Rendered hidden inside a cascading IGridOwner so each GridColumn registers itself with the grid. See Column sets. | ### Layout | Name | Type | Default | Description | |---|---|---|---| | Height | string? | null | CSS height of the grid. A bounded height makes the body the scroll container and is required by row windowing and ItemsProvider; without one a local source larger than AutoPageRowThreshold falls back to paging. | | Width | string? | null | CSS width of the grid host; blank leaves the width to the container. | | WidthMode | GridWidthMode | GridWidthMode.FillAvailable | FillAvailable stretches the table to the container and overflows only when the columns need more; FitColumns keeps every column at its own width, so the table may end short of the container or scroll horizontally. | | EnableViewportSafeSizing | bool | true | Wraps a pixel, viewport or calc Height or Width in min() with the matching viewport-safe limit when it could exceed it; percentages pass through unchanged. | | ViewportSafeMaxWidth | string | "" | Upper bound applied to Width by viewport-safe sizing; blank applies none. | | ViewportSafeMaxHeight | string | "" | Upper bound applied to Height by viewport-safe sizing; blank applies none. | | ExtendVerticalScrollbarIntoHeader | bool | false | Adds the fx-grid-vscroll-header-gutter class, a header-height scrollbar gutter so the vertical scrollbar appears to start at the header rather than at the first data row. | | ShowHeader | bool | true | False skips the thead entirely, including header bands and the filter row, and reports zero header rows to assistive technology. | ### Context menu | Name | Type | Default | Description | |---|---|---|---| | OnContextMenu | EventCallback | | Raised from the grid host's contextmenu event; attaching a handler also suppresses the browser menu. | | PreventDefaultContextMenu | bool | false | Suppresses the browser context menu on the host even with no OnContextMenu handler and no cell context menu. | | StopContextMenuPropagation | bool | false | Stops the contextmenu event from bubbling past the grid host. | ### Rows | Name | Type | Default | Description | |---|---|---|---| | RowHeight | int | 0 | Fixed row height in px; 0 lets rows size to content, and row windowing then measures them. Never resolves below MinRowHeight. | | AllowRowResizing | bool | false | Shows a drag handle on the last data cell so users can resize rows; a resized height overrides RowHeight. Incompatible with ItemsProvider and turns off fixed-pitch row windowing. | | AllowRowReorder | bool | false | Shows a row-header drag handle for moving rows to a new position; hidden while the grid is grouped. | | RowReorderPredicate | Func? | null | Per-row gate for the reorder handle; null shows it on every row. | | ShowRowSelectorHandle | bool | false | Shows a narrow row-selector handle column, grid chrome rather than a data column; hidden while the grid is grouped. | | RowSelectorHandleShape | GridRowSelectorHandleShape | GridRowSelectorHandleShape.HalfButton | Look of the handle: HalfButton, Button, CheckBox or Flat. It sets the handle's size, border, radius and background, and Flat adds fx-row-selector-cell-flat to the cell. | | RowSelectorHandleWidth | int | 18 | Width of the handle column in px, clamped to 12-40. | | RowSelectorHandlePredicate | Func? | null | Per-row gate for the selector handle; null shows it on every row, and a predicate that throws hides it. | | RowSelectorHandleEmphasisPredicate | Func? | null | Marks rows whose selector handle draws emphasized; null emphasizes none. | | MinRowHeight | double | 16 | Floor in px for every resolved row height: RowHeight, RowHeightSelector results and user resizes. | | RowHeightSelector | Func? | null | Per-row height in px, called with the item and its resolved row index; null or a non-positive result falls back to RowHeight. Incompatible with ItemsProvider. | | RowCssClassSelector | Func? | null | Extra CSS class for a data row, called with the item and row index. | | RowExportStyleSelector | Func? | null | Row style applied when exporting to Excel or HTML, called with the item and row index. See Export & templates. | | CellExportStyleSelector | Func? | null | Cell style applied when exporting, called with the item, field and row index. See Export & templates. | | RowTooltipSelector | Func? | null | Text for the data row's title attribute, shown wherever the pointer rests on the row; a cell with its own title keeps it. Null or empty adds none. | ### Editing | Name | Type | Default | Description | |---|---|---|---| | CellEditablePredicate | Func? | null | Per-cell edit gate, (item, field), checked on top of the column's AllowEditing at every edit start, mass-edit target and editable render cue; blocked cells are skipped silently. See Batch editing. | | BatchEditBehavior | GridBatchEditBehavior | GridBatchEditBehavior.MultiRow | MultiRow: a click opens the editor and typed values can fan out to every selected row. SingleCell: click selects, double-click edits, and typing commits to that one cell. See Batch editing. | | EditOnSingleClick | bool | false | Opens an editable batch cell on a plain click instead of click-to-select, type-to-replace. See Batch editing. | | TextEditorTypingBehavior | TextBoxTypingBehavior | TextBoxTypingBehavior.ServerBacked | Transport for the generated text cell editors: ServerBacked or ClientBuffered. See Typing modes. | | UseClientBufferedTextEditing | bool? | null | Overrides TextEditorTypingBehavior: true forces client-buffered editors, false server-backed, null follows the mode. See Typing modes. | | AllowSingleCellColumnMassEdit | bool | false | In SingleCell mode, lets Ctrl/Cmd and Shift select several cells of one column and commits the typed value to all of them. See Batch editing. | | AllowCellFormulas | bool | false | Evaluates text cell values that start with = as row-scoped formulas when building display values, and bypasses the display-value cache. Column Formula values are evaluated regardless. See Dynamic columns. | ### Sorting | Name | Type | Default | Description | |---|---|---|---| | AllowSorting | bool | false | Master switch for header-click sorting, the sort items in the header menu and the Sort dialog; each column's own AllowSorting must also be true. | | AllowMultiSorting | bool | true | Allows several sort levels through the Sort dialog; header clicks still sort one column. Requires AllowSorting. | | ShowMultiSortMenu | bool | true | Shows the Custom Sort entry in the header right-click menu when both sorting switches are on; false hides it while keeping multi-column sorting available. | ### Filtering | Name | Type | Default | Description | |---|---|---|---| | AllowFiltering | bool | false | Master switch for the header filter icon, the filter-bar inputs, the header menu's filter items and the expression-filter button; the column's own AllowFiltering must also be true. | | EnableAdvancedFilterPopup | bool | false | Adds a second condition (Condition 1, AND/OR, Condition 2) to the column filter popup, honored by local and provider filtering. | | EnableBlankRowFilter | bool | false | Adds (Blanks) and (Non-Blanks) quick filters to the column filter popup. | | ClearFiltersOnDataSourceChange | bool | true | Clears all transient filter state when a different DataSource instance arrives, so one context's filter cannot hide another context's rows. | | ShowHeaderFilterIcon | bool | true | Shows the clickable filter icon in each filterable header; turn it off when the grid already renders filter-bar inputs. | | HeaderFilterIcon | string | string.Empty | Glyph or text for the header filter icon; blank renders the built-in glyph. | | ShowSearchBar | bool | false | Adds a search box to the built-in toolbar, which then renders, keeping rows whose text in any visible column contains the typed value; applied as you type or on commit. | ### Paging | Name | Type | Default | Description | |---|---|---|---| | PageSize | int | 50 | Rows per page; PageSettingsRef.PageSize takes precedence when a settings component is present. See Scroll vs paging. | | PageSizes | int[] | [25, 50, 100, 200] | Choices in the pager's page-size list; PageSettingsRef.PageSizes wins, and an empty array falls back to the built-in set. See Scroll vs paging. | | PageButtonCount | int | 5 | Number of page buttons the pager shows; PageSettingsRef.PageCount wins, and a non-positive value falls back to 5. | | AutoPageRowThreshold | int | 10000 | With AllowPaging off and no Height, a local source with more rows than this switches to paging on its own; 0 or less disables the switch. | | AllowPaging | bool | false | Turns the pager on. Off, paging still engages for an unbounded-height grid above AutoPageRowThreshold. See Scroll vs paging. | ### Selection | Name | Type | Default | Description | |---|---|---|---| | CellSelectablePredicate | Func? | null | In cell selection mode, an (item, field) gate shared by pointer, range and keyboard selection; cells it rejects are pruned from the selection and skipped when the grid looks for its first and last cell. Null leaves read-only cells selectable. | | AutoSelectFirstRow | bool | false | Selects and focuses the first visible row when a selectable row grid first receives rows and after a sort reorders them; ignored for checkbox-only and cell selection. See Master-detail. | | InitialSelectedRowIndex | int? | null | Displayed-row index to select before the first visible render, for pickers that already know their value; re-applied when the index or the data source changes. See Master-detail. | | FocusInitialSelection | bool | false | Gives the initial selection keyboard focus once its browser reveal has completed. | | NotifyInitialSelectionChanged | bool | false | Raises the normal selection-changed callback for the seeded initial selection; pickers usually leave it false because nothing changed. | | InitialSelectionReady | EventCallback | | Fires after the seeded row has rendered and its browser reveal has completed; a first-paint readiness gate for picker hosts. | | AllowSelection | bool | true | False makes the grid cursor-only: clicks and keys move the active cell and editing still works, but no row or cell is ever selected and no selection event fires. See Master-detail. | | HighlightSelectedRows | bool | true | Applies fx-selected and the data-fx-row-highlight flag to selected rows; false keeps the selection but draws nothing. See Master-detail. | | ShowActiveCell | bool | true | False hides the cell cursor (the host gets data-fx-active-cell of hidden) and turns off the browser-side navigation preview; the active cell still exists as keyboard origin and scroll anchor. | | AllowRowDragSelection | bool | true | Lets a primary-button press on a row start spreadsheet-style drag selection in multi-select row grids; click selection is unaffected. | | CommitSelectedRowOnEnter | bool | false | Plain Enter on the focused grid with one selected row, no open editor and no open popup invokes OnRecordDoubleClick for that row, so a picker accepts with Enter. | | ShowSelectionInfoBar | bool | false | Shows the rows-selected banner with its Clear Selection button above the header whenever more than one row, or any cell, is selected. | | TypeAheadTargetField | string? | null | Field that receives multi-row type-ahead when no selection gesture has captured an editable target column. | | TypeAheadFallbackField | string? | null | Alias for TypeAheadTargetField; used only when that one is blank. | | ShowRowSelectionEditColumnCue | bool | false | In multi-row selection, highlights the column that bulk type-ahead will write to across the selected rows, and lets such a column be captured as the target. | ### Keyboard | Name | Type | Default | Description | |---|---|---|---| | TabNavigationMode | GridTabNavigationMode | GridTabNavigationMode.WrapRows | Tab and Shift+Tab inside a cell: WrapRows walks the cells and wraps between rows, WrapRowsUntilEdge stops at the grid's edges, PageControl hands both keys to an enclosing PageControl graph. See Page navigation. | | HostTabIndex | int? | null | tabindex of the grid host element; null renders 0. | | SeedActiveCellOnHostFocus | bool | false | When the host gains focus with no active cell, makes the first visible cell current so arrows, Tab and type-to-edit work at once; entry through page navigation seeds regardless. | | ExitGridOnTerminalTab | bool | false | Tab on the last navigable cell and Shift+Tab on the first move focus to the adjacent control outside the grid instead of wrapping. | | AutoFocusFirstCell | bool | false | Makes the first cell current and focuses the grid on open, retried for up to three renders while rows arrive; stops once a cell is current. | | EnterAdvancesToNextCell | bool | false | Enter in an open editor commits and moves to the next editable cell, wrapping rows, like Tab; Shift+Enter commits in place. | | EnableTypeSearch | bool | false | Read-only type search: printable keys typed into the focused grid find the first row whose text in the active column starts with the buffer, and the matched prefix is highlighted in that column. | | TypeSearchDelaySeconds | int | 3 | Seconds of inactivity before the type-search buffer resets; values below 1 count as 1. | ### Columns | Name | Type | Default | Description | |---|---|---|---| | AllowGrouping | bool | false | Enables grouping: the group drop area, header drag-to-group, the header menu's group items and grouped row rendering. See Grouping & totals. | | AllowResizing | bool | false | Shows column resize grips and enables drag resizing; the column's own AllowResizing must also be true. | | AllowColumnAutoFit | bool | true | Best fit: double-clicking a resize grip sizes that column to its content, and the header menu offers Best Fit and Best Fit All Columns. The grip needs AllowResizing. | | AutoFitSampleSize | int | 50 | How many rows of the current view a best fit samples; values below 1 count as 1. | | AutoFitEveryRow | bool | false | When the sample also covers every row in view, a best fit measures the display text of every row, including rows outside the rendered window, instead of only the sampled rows. | | AutoFitMinWidth | double | 40 | Floor in px for a best-fit width; a column's own MinWidth wins. | | AutoFitMaxWidth | double | 0 | Ceiling in px for a best-fit width; 0 uses the grid's own ceiling, and a column's own MaxWidth wins. | | AutoFitWidthScale | double | 1 | Multiplier applied to the measured content width before the bounds are applied; values below 1 count as 1. | | AutoFitUseDomMeasurement | bool | true | Measures rendered text widths through the DOM; false, or an unavailable measurement, falls back to the character-count estimate. | ### Appearance | Name | Type | Default | Description | |---|---|---|---| | SelectedRowBackground | string | string.Empty | Sets --fx-grid-selected-row-bg on the host; blank leaves the theme's value. | | SelectedRowForeground | string | string.Empty | Sets --fx-grid-selected-row-color on the host; blank leaves the theme's value. | | SelectedRowHoverBackground | string | string.Empty | Sets --fx-grid-selected-row-hover-bg on the host; blank falls back to the selected-row background. | | RowHoverBackground | string | string.Empty | Sets --fx-grid-row-hover-bg, the hover background of unselected rows; blank leaves the theme's value. | | ShowRowCountInFooter | bool | false | Shows the filtered row count: a footer line when not paging, or inside the pager when paging. | | EnableHover | bool | true | Adds fx-hover to data rows so they highlight under the pointer. | | EnableAltRow | bool | true | Adds fx-alt-row to every second data row. | ### Toolbar | Name | Type | Default | Description | |---|---|---|---| | Toolbar | List? | null | Names of the built-in toolbar buttons, rendered in order. add, edit, delete, csv, excel and pdf run their built-in action; every click also reaches OnToolbarItemClick. | | ShowGridToolbar | bool? | null | Forces the toolbar on or off. null shows it when Toolbar has items, ShowSearchBar is on or a GridToolBarTemplate is set. | | OnToolbarItemClick | EventCallback | | Fires with the item name after the built-in action for that toolbar button has run. | | GridToolBarTemplate | RenderFragment? | null | Extra content appended inside the toolbar after the buttons and the search box; setting it makes the toolbar render. | ### Options rail | Name | Type | Default | Description | |---|---|---|---| | ShowAdvancedViewToggleButton | bool | false | Adds a toggle in the group strip that hides the expression-filter button and the options rail until the user switches to the advanced view. The toggle only renders when one of those tools is configured. | | DefaultAdvancedView | bool | false | Initial state of the advanced view when ShowAdvancedViewToggleButton is on; read once, after that the toggle owns it. | | ShowExpressionFilterButton | bool | false | Shows the expression-filter button in the group strip; needs AllowFiltering. | | ShowGridOptionsRail | bool | false | Renders the side rail; it also needs columns and at least one of the rail buttons below. | | ShowColumnOptionsButton | bool | false | Column options button on the rail, which opens the column panel. | | ShowFilterPanelButton | bool | false | Declared, but never read; column filtering lives in each column header popup. | | AllowPivoting | bool | false | Lets the grid switch into the embedded pivot view; turning it off while in pivot mode returns the grid to its rows. | | ShowPivotPanelButton | bool | false | Pivot button on the rail; also needs AllowPivoting. | | ShowGridThemeToggle | bool | false | Theme button on the rail, which opens the Theme panel where the user picks one of the GridTheme schemes. | | Theme | GridTheme | GridTheme.Default | Initial color scheme; read once, after which the Theme panel owns the active scheme. | | ShowGridBackButton | bool | false | Back button on the rail that leaves the pivot view and closes the open panel. | ### Grouping | Name | Type | Default | Description | |---|---|---|---| | ShowExpandAllButton | bool | true | Declared, but never read. | | ShowCollapseAllButton | bool | true | Declared, but never read. | | GroupColumns | List? | null | Fields grouped on load; a new list replaces the live group descriptors on the next parameter set. See Grouping & totals. | | GroupHeaderTextSelector | Func, string>? | null | Called with the field, the raw key and the group's items to produce the group header text; a blank result falls back to the key. Collapse state still keys on the raw value. | | FocusGroupHeaderOnContextMenu | bool | false | Makes a right-click on a group header the current group before the context-menu event bubbles, so a host handler can read GetCurrentGroup(). | | AggregateRows | List? | null | Aggregate definitions computed per group and for the grid footer; the tables below describe AggregateRow and AggregateColumn. With an ItemsProvider the fields and types travel as query aggregates instead. See Grouping & totals. | | ShowGroupExpandCollapse | bool | true | While groups exist, shows the expand-all/collapse-all toggle and the clear-all-grouping button in the group strip. | | HideGroupedColumns | bool | true | Removes the grouped fields from the visible columns and renders a placeholder column of the same width for each of them. | | ShowGroupCount | bool | false | Appends the item count to each group header row. | | DefaultGroupsCollapsed | bool | false | Starts every group collapsed; applied once on the first parameter set, after which the user's expand and collapse actions own the state. Provider groups honor it too. | | GroupedColumnColor | string | "" | CSS color for the grouped value: the header text falls back to it when GroupItemTextColor is empty, and a 12 percent tint of it feeds the --fx-grid-group-color-soft chip background. | | GroupItemTextColor | string | "" | Text color of the grouped value on group header rows; empty falls back to GroupedColumnColor. | | GroupTotalTextColor | string | "" | Text color of group aggregates: caption totals, header-row totals and footer totals. Empty keeps the stylesheet colors. | | GroupExpandIconStyle | GroupExpandIconStyle | GroupExpandIconStyle.PlusMinus | Built-in expand/collapse glyph preset for group headers, PlusMinus or Triangle; it picks the glyph pair, the CSS class and the inline style unless the overrides below replace them. | | CollapsedGlyph | string? | null | Glyph shown on a collapsed group instead of the preset's plus or right-pointing triangle. | | ExpandedGlyph | string? | null | Glyph shown on an expanded group instead of the preset's minus or down-pointing triangle. | | ExpandIconStyle | string? | null | Inline CSS applied to the glyph span instead of the preset's style. | | ExpandIconTemplate | RenderFragment? | null | Replaces the glyph span entirely; receives true when the group is expanded and must handle its own click. | | GroupFooterTemplate | RenderFragment? | null | Declared, but never read; group footers are built from AggregateRows. See Grouping & totals. | | GroupFootersAlwaysVisible | bool | false | Declared, but never read. See Grouping & totals. | ### Header menu | Name | Type | Default | Description | |---|---|---|---| | AllowColumnReorder | bool | true | Lets a header be dragged onto another header's drop zone to move the column. Drag-to-group is wired separately through the group strip. See Column reorder. | | EnableHeaderContextMenu | bool | true | Opens the built-in menu on a header right-click; off, the event bubbles to the host unless ShowColumnMenu is on. | | HeaderContextMenuShowsColumns | bool | false | Replaces the header menu's commands with a checked list of columns that toggles their visibility. | | HeaderClickShowsColumns | bool | false | A left-click on a header opens that checked column list instead of sorting; needs the header menu or ShowColumnMenu. | | OnHeaderAttachmentsRequested | EventCallback | | Adds an Attachments item to the header menu and fires with the column's field; without a handler the item is not rendered. | | EnableCellContextMenu | bool | false | Opens a Cut, Copy, Paste and Delete menu on a data-cell right-click, except while a row or batch edit is active. Off, the right-click reaches OnContextMenu. | | ColumnReorderPipeColor | string | "#2b2b2b" | CSS color of the vertical insertion pipe shown while a header is dragged; blank falls back to the default. | | ColumnRenameMaxLength | int | 255 | Longest caption the header rename box accepts; 0 removes the page limit. A registered IGridColumnCaptionLimit can lower it, never raise it. | | ShowColumnMenu | bool | false | Adds sort, filter, visibility, auto-fit and left/right locking commands to the header menu, and lets that menu open even when EnableHeaderContextMenu is off. | | ShowColumnMenuButton | bool | false | Three-dot button on each header that opens the header menu; needs EnableHeaderContextMenu or ShowColumnMenu. | ### Print | Name | Type | Default | Description | |---|---|---|---| | ShowPrintOptionsDialog | bool | true | The header menu's Print command opens the print-options dialog seeded from the defaults below; off, it exports a PDF with those defaults at once. See Export & templates. | | DefaultPrintOrientation | GridPdfOrientation | GridPdfOrientation.Portrait | Page orientation the print options start from. See Export & templates. | | DefaultPrintPageSize | GridPdfPageSize | GridPdfPageSize.Letter | Page size (Letter, Legal or A4) the print options start from. See Export & templates. | | DefaultPrintColumnLayout | GridPdfColumnLayout | GridPdfColumnLayout.WrapText | How columns meet the page width: WrapText, ClipText or FitColumnsToPage. See Export & templates. | | DefaultPrintGridLines | bool | true | Whether the printed table draws grid lines. See Export & templates. | | DefaultPrintZoomMode | GridPdfZoomMode | GridPdfZoomMode.FitToPage | FitToPage or Percent; the latter uses DefaultPrintZoomPercent. See Export & templates. | | DefaultPrintZoomPercent | int | 100 | Zoom for the Percent mode, clamped to 25 to 200. A change to any print default re-seeds the options unless the dialog is open. See Export & templates. | | IncludeTotalsInExport | bool | true | Appends the AggregateRows marked ShowInFooter as total rows at the end of every export table. See Export & templates. | | DelimitedExportEncoding | GridDelimitedTextEncoding | GridDelimitedTextEncoding.Utf8NoBom | Text encoding of CSV and TSV files; the other formats ignore it. See Export & templates. | | ExportAllProviderItems | bool | false | With an ItemsProvider, exports page through the whole current query instead of the loaded window. See Export & templates. | | ProviderExportPageSize | int | 1_000 | Rows requested per page during a complete provider export, clamped to 1 to 100000. See Export & templates. | | ProviderExportProgressChanged | EventCallback | | Raised after each received export page and once more on completion or cancellation. See Export & templates. | ### Column chooser | Name | Type | Default | Description | |---|---|---|---| | AvailableColumns | IEnumerable? | null | Schema for the Choose Columns dialog and the column panel, so columns not currently rendered can be listed unchecked. With no GridColumn children and auto-generation off it also supplies transient columns. Null falls back to the rendered columns. See Dynamic columns. | | DefaultColumns | IEnumerable? | null | Layout applied by the dialog's Restore Default Layout button: listed columns take its visibility and order, the others keep theirs. Null restores the snapshot taken when the dialog opened. | | OnColumnsChosen | EventCallback | | Fires on OK in the Choose Columns dialog with the chosen visibility and order; a subscribed host applies the layout itself and the grid only persists it. Unsubscribed, the grid applies it. | | OnLayoutChanged | EventCallback | | Fires with a GridSettings snapshot after the user reorders, resizes, groups, hides or renames a column. | | PersistenceKey | string? | null | Key under which an IGridSettingsStore registered in DI loads the saved layout once columns exist and saves it after each user change; empty, or no store, disables persistence. | | ColumnChooserTemplate | RenderFragment? | null | Replaces the body of the Choose Columns dialog; receives a GridColumnChooserContext. | | OnStateChanged | EventCallback | | Fires with a detached GridState snapshot and the kind of change after user-driven state changes; suppressed while a state is being applied. | ### Chart | Name | Type | Default | Description | |---|---|---|---| | ShowAsChart | bool | false | Renders each row as a mini bar chart through ChartControl instead of the table; needs ChartValueFields. Row windowing and column virtualization are off in this view. | | ChartValueFields | IList? | null | Properties whose numeric values become the bars of each row. | | ChartLabelField | string? | null | Property used as each row's label; null uses the first visible column's field. | | ChartValueLabels | IList? | null | Axis labels for the value fields, passed to the chart. | | ChartBarColor | string | "#2563eb" | Bar color passed to the chart. | | ChartShowValues | bool | false | Prints each bar's value above it. | ### Settings | Name | Type | Default | Description | |---|---|---|---| | FilterSettingsRef | FilterSettings? | null | Plain FilterSettings object read for the filter type, case sensitivity, search-as-you-type, the immediate-mode delay and the filter-row operators. | | PageSettingsRef | PageSettings? | null | Plain PageSettings object whose PageSize, PageSizes and PageCount take precedence over the grid's own paging parameters. | | EditSettingsRef | EditSettings? | null | Plain EditSettings object that turns editing on: mode, adding, deleting, confirmation and new-row position are all read from it. See Batch editing. | | SelectionSettingsRef | SelectionSettings? | null | Plain SelectionSettings object read for the selection mode, the checkbox column and checkbox-only selection. | | EventsRef | GridControlEvents? | null | Plain GridControlEvents bundle; each grid event is raised through it when the matching callback has a delegate. | | RowResizing | EventCallback> | | Fires while a row is being resized, after the EventsRef counterpart; set Cancel to keep the old height or change NewHeight. | | RowResized | EventCallback> | | Fires when the resize ends, with the final height. | | RowReordering | EventCallback> | | Fires before a dragged row is moved; set Cancel to abandon the drop. | | RowReordered | EventCallback> | | Fires after the row has moved and been selected, with the resolved NewIndex. | ### Editing | Name | Type | Default | Description | |---|---|---|---| | NewItemFactory | Func? | null | Creates the item for a new row; null uses the parameterless constructor and throws when there is none. See Batch editing. | | EnsureTrailingNewRow | bool | false | Keeps one blank new row at the end of an IList data source while EditSettings.AllowAdding is on. | | IsTrailingNewRow | Func? | null | Tells the grid whether its tracked trailing row is still blank; null, or a predicate that throws, counts as blank. | | BlankTrailingNewRowText | bool | false | Shows the tracked trailing row with empty cells while it is blank, whatever defaults the factory gave it; needs IsTrailingNewRow. | | AddNewRowOnLastCellExit | bool | false | Moving forward from the last navigable cell appends a new row and starts editing its first editable cell; needs EditSettings.AllowAdding and an IList data source. | | CanAddNewRowOnLastCellExit | Func? | null | Guard called with the current row before that append; returning false leaves focus at the grid edge. | | CloneFactory | Func? | null | Copies a row before editing; null creates a new item and copies the values across, entry by entry for dictionary-shaped rows and property by property otherwise. | | ValidationSettings | GridValidationSettings? | null | Opts row and batch editing into EditContext validation: data annotations, a custom validator and validation on each field change. Null performs no model validation. | ### Scrolling | Name | Type | Default | Description | |---|---|---|---| | WindowOverscanRows | int | 60 | Rows rendered above and below the visible slice, and the ceiling for the cell budget. See 100k rows. | | WindowOverscanCellBudget | int | 900 | Per-side overscan budget in cells: the effective row overscan is the budget divided by the visible column count, clamped between 15 (or WindowOverscanRows when lower) and WindowOverscanRows. 0 disables the budget. See 100k rows. | | DeferredScrollOverscanRows | int | 20 | Rows buffered around the destination when a thumb release commits with ScrollTrack off; never below the refresh guard nor above the effective overscan. | | ScrollTrack | bool | true | True tracks the vertical thumb live. False renders a browser-owned proxy thumb that previews locally and commits the destination window in one server render on release. | | WheelScrollScale | double | 1d | Multiplier on vertical wheel and trackpad travel while the proxy thumb owns scrolling, clamped to 0.1 to 2. | | EnableScrollBoundarySlowdown | bool | false | Slows wheel movement inside the prefetch zone near the rendered edge; only in force together with EnableScrollBoundaryGuard. | | EnableAdaptiveWheelScrollPacing | bool | false | Learns a per-grid wheel rate from the browser's acknowledgment time; needs the guard and the slowdown. | | EnableScrollBoundaryGuard | bool | false | Pauses wheel momentum on the last rendered row until the next window arrives, so a spacer is never shown; only while ScrollTrack is false. | | EnableScrollBoundaryTelemetry | bool | false | Turns on browser-side wheel-window telemetry for the bench pages; only while ScrollTrack is false. | | DiagnosticWindowScrollDelayMs | int | 0 | Bench-only delay, clamped to 0 to 5000 ms, added to each row-window callback of this grid. | | MinimumRowsForWindowing | int | 0 | Collection data sources with this many rows or fewer skip row windowing; 0 windows every grid, and sources without a count keep windowing. | | EnableGroupedRowWindowing | bool | true | Windows grouped grids over a flattened header, item and footer stream; off, a grouped grid renders every row. | | PerformanceMode | GridPerformanceMode | GridPerformanceMode.ClientPreviewAndServerOptimized | ServerOptimized and ClientPreviewAndServerOptimized keep the server-side row lookup and render caches; ClientPreview and the combined mode move the cursor in the browser before the server render when ShowActiveCell is on. | ### Filtering | Name | Type | Default | Description | |---|---|---|---| | FilterMode | GridFilterMode | GridFilterMode.None | Simple, SimpleWithMenu and Excel add a filter row under the header and count it in the ARIA row count; the grid reads no other value. | | ShowMultiColumnSortingIndex | bool | false | Shows the sort priority badge next to the sort arrow when several columns are sorted. | ### Master detail | Name | Type | Default | Description | |---|---|---|---| | DetailTemplate | RenderFragment? | null | Renders a detail row under each expanded item and enables the expand column and the ExpandRow and CollapseRow API. Not allowed with a flat ItemsProvider. See Master-detail. | | ExpandMode | GridExpandMode | GridExpandMode.Multiple | Single collapses the other rows when one expands; Multiple allows several and the expand-all button. See Master-detail. | | ShowExpandColumn | bool | true | Shows the expand column when a DetailTemplate is set. See Master-detail. | | ShowExpandAll | bool | false | Puts an expand-all/collapse-all button in the expand column's header; only in Multiple mode. See Master-detail. | | RowExpand | EventCallback | | Fires with the item after it has been expanded. See Master-detail. | | RowCollapse | EventCallback | | Fires with the item after it has been collapsed. See Master-detail. | ### Columns | Name | Type | Default | Description | |---|---|---|---| | AutoGenerateColumns | bool | false | Builds the columns from the public readable properties of TValue and exposes them through Columns. See Dynamic columns. | | ColumnHeaderBands | IReadOnlyList? | null | One-level parent header bands over the listed fields; an entry here wins over a column's HeaderBand. Bands disable column virtualization. See Dynamic columns. | | EnableColumnVirtualization | bool | false | Renders only the horizontally visible non-frozen columns plus the overscan; frozen columns stay mounted. Falls back to the full column set for pivot, chart, grouped, inline-editing, banded, templated, stacked and adaptive layouts. See Wide grids. | | ColumnVirtualizationOverscan | int | 2 | Extra non-frozen columns kept on each side of the viewport. See Wide grids. | | ColumnVirtualizationDefaultWidth | double | 0 | Pixel width assumed for columns with no pixel Width and no runtime resize; 0 makes such a column force the full render. See Wide grids. | | ShowColumnVirtualizationFallback | bool | true | Shows a status line explaining why virtualization was requested but the grid fell back to the full render. See Wide grids. | ### Provider | Name | Type | Default | Description | |---|---|---|---| | ItemsProvider | GridItemsProvider? | null | Range provider that replaces DataSource; needs a bounded Height and, without provider grouping, fixed-height rows. Filtering, sorting and grouping become request descriptors. See On-demand loading. | | ItemsProviderContextKey | object? | null | Opaque value sent with every request; a change starts a new query generation from the first row. | | ItemKeySelector | Func? | null | Stable key for rendering, selection state and grid state when provider calls return new instances of the same row. See On-demand loading. | | ItemsProviderCacheSize | int | 4 | Completed ranges kept per grid, clamped to 1 to 8. | | EnableProviderFilterValueRequests | bool | false | Lets the Excel-style checklist ask the provider for distinct values with the FilterValues purpose; off, a partial checklist selection cannot be applied. See On-demand loading. | | ProviderFilterValueRequestSize | int | 1_000 | Distinct values requested for one checklist, clamped to 1 to 100000. | | EnableProviderGrouping | bool | false | Provider-executed lazy grouping when AllowGrouping and group descriptors are active; groups and their rows load on expansion. See On-demand loading. | | ProviderGroupPageSize | int | 100 | Groups requested per lazy group page, clamped to 1 to 10000. See On-demand loading. | | ProviderGroupItemPageSize | int | 250 | Leaf rows requested per lazy group page, clamped to 1 to 100000. See On-demand loading. | | ProviderGroupsInitiallyCollapsed | bool | true | Newly received provider groups start collapsed; off, DefaultGroupsCollapsed decides. See On-demand loading. | ### Presentation | Name | Type | Default | Description | |---|---|---|---| | GridLines | GridLines | GridLines.Both | Which cell borders the stylesheet draws: Both, Horizontal, Vertical or None; Default means Both. | | Density | GridDensity | GridDensity.Default | Compact adds the fx-grid-density-compact class for tighter rows. | | PagerPosition | GridPagerPosition | GridPagerPosition.Bottom | Where the pager renders while paging is active: bottom, top or both. | | PagerTemplate | RenderFragment? | null | Replaces the pager contents; receives a GridPagerContext with the page numbers and navigation callbacks. | | RowTemplate | RenderFragment>? | null | Emits all data cells of a flat row itself, so built-in cell editing in that row is host-owned. Turns off row windowing and column virtualization, and is rejected with a flat ItemsProvider. | | NoDataTemplate | RenderFragment? | null | Content of the empty row when the current view has no records. | | DataLayoutMode | GridDataLayoutMode | GridDataLayoutMode.Columns | Stacked adds the stacked-layout class and turns off row windowing and column virtualization; rejected with a flat ItemsProvider. | | AdaptiveMode | GridAdaptiveMode | GridAdaptiveMode.None | Auto adds the adaptive class; any value other than None turns off row windowing and column virtualization and is rejected with a flat ItemsProvider. | | StackedColumnsCount | int | 1 | Sets the --fx-grid-stacked-columns variable for the stacked layout, clamped to 1 to 6. | | AccessibleLabel | string | "Data grid" | The table's aria-label. | | CustomKeyboardShortcuts | IReadOnlyDictionary? | null | Maps gestures such as Ctrl+Home or Alt+ArrowDown to a GridKeyboardCommand, matched case-insensitively before the built-in keys. | ### Aggregate row | Name | Type | Default | Description | |---|---|---|---| | Columns | List | new() | The aggregates in this row; each AggregateColumn yields one value per group and one for the grid footer. | | ShowInGroupFooter | bool | true | Renders the row as a footer under each group's items; it is also counted in the grouped-window height math. | | ShowInFooter | bool | false | Renders the row in the grid footer across all data, and includes it in exports while IncludeTotalsInExport is on. | | ShowInGroupCaption | bool | false | Appends each value inline to the group header label, formatted with GroupCaptionTemplate. | | ShowInGroupHeader | bool | false | Adds column-aligned cells to the group header row from the first aggregate column onward, formatted with GroupCaptionTemplate or else GroupFooterTemplate. | ### Aggregate column | Name | Type | Default | Description | |---|---|---|---| | Field | string | "" | Property aggregated; with an ItemsProvider it is sent as a query aggregate. | | Type | AggregateType | AggregateType.Sum | Sum, Average, Count, Min or Max; field and type together key the computed value. | | Format | string? | null | .NET format string applied in the current culture when the value is IFormattable. | | FooterTemplate | string | "{value}" | Text with a {value} placeholder used for the grid footer and as the fallback for the other templates; Grand Total, Sub Total and Total prefixes are stripped from the result. | | GroupFooterTemplate | string? | null | Template for group footers and, failing a caption template, for header-row cells; null falls back to FooterTemplate. | | GroupCaptionTemplate | string? | null | Template for the inline caption values and the header-row cells; null falls back to FooterTemplate for captions and to GroupFooterTemplate for header-row cells. | ## Examples ### Airports ```razor @using Fx.ControlKit @using Fx.ControlKit.Grid
``` ```csharp // Airports: the OurAirports snapshot (Data/AirportData.cs), grouped by continent to start. Count needs a numeric field, so it // counts Runways, which every airport has. private readonly IReadOnlyList _airports = AirportData.Airports; private List _groupColumns = new() { nameof(Airport.Continent) }; private List _aggregates = new() { new AggregateRow { ShowInGroupCaption = true, Columns = new() { new AggregateColumn { Field = nameof(Airport.Runways), Type = AggregateType.Count, GroupCaptionTemplate = "{value} airports" }, new AggregateColumn { Field = nameof(Airport.ElevationFt), Type = AggregateType.Average, Format = "N0", GroupCaptionTemplate = "avg elevation {value} ft" }, new AggregateColumn { Field = nameof(Airport.LongestRunwayFt), Type = AggregateType.Max, Format = "N0", GroupCaptionTemplate = "longest runway {value} ft" }, } } }; ``` --- # Real-Time Blazor Grid with Live Updates URL: https://flexcoreui.com/demo/grid/live-updates Section: Data Grid Controls: GridControl, GridColumn Keywords: real-time grid, live data, observable data, high-frequency updates, cell template Keep a Blazor grid in step with live data: rows change several times a second while users sort, with templated cells and a sparkline column. ## Documentation ### Column | Name | Type | Default | Description | |---|---|---|---| | Field | string | | Property the column reads, and sorts by. | | HeaderText | string? | | Header caption. | | Template | RenderFragment? | | Markup for the cell, given the row object as context; used here for the price tint, the change arrows, the trend line and the profit color. | | Type | ColumnType | | Text, Number, Date or Boolean: decides editor, alignment default and sorting. | | Format | string? | | Format string for the cell text when there is no template. | | TextAlign | TextAlign? | null | Left, Right or Center; the type's default when null. | | Width | string? | | CSS width of the column. | | AllowSorting | bool | | Off on the trend column, whose field only repeats the ticker. | ## Examples ### Ticker ```razor @using System.Diagnostics @using Fx.ControlKit @using Fx.ControlKit.Grid @(_streaming ? "Pause" : "Start") Tick once Reset

@Status

``` ```csharp private readonly SelectionItem[] _intervalItems = { new("100", "100 ms"), new("250", "250 ms"), new("500", "500 ms"), new("1000", "1 s") }; private List _rows = Load(); private System.Timers.Timer? _timer; private bool _streaming; private int _intervalMs = 500; // Measured per tick: rows changed, and the server render time from the tick to the component's next OnAfterRender. private readonly Stopwatch _tickWatch = new(); private readonly Queue _recent = new(); private bool _renderPending; private int _ticks, _lastChanged; private double _lastMs; private string Status { get { var avg = _recent.Count == 0 ? 0 : _recent.Average(); var state = _streaming ? $"Streaming every {_intervalMs} ms" : "Paused"; return _ticks == 0 ? $"{state}. {_rows.Count} instruments, no ticks yet." : $"{state}. {_ticks} ticks; the last changed {_lastChanged} rows and rendered in {_lastMs:0.0} ms on the server (average {avg:0.0} ms over the last {_recent.Count})."; } } private void ToggleStreaming() { if (_streaming) { _timer?.Stop(); _streaming = false; return; } _streaming = true; StartTimer(); } private void PickInterval(IReadOnlyList values) { if (values.Count == 0) return; _intervalMs = int.Parse(values[0]); if (_streaming) StartTimer(); } private void StartTimer() { _timer?.Stop(); _timer?.Dispose(); _timer = new System.Timers.Timer(_intervalMs) { AutoReset = true }; _timer.Elapsed += async (_, _) => await InvokeAsync(Tick); // back on the circuit before touching the rows _timer.Start(); } // One tick: three to seven instruments move by up to 1.5 percent; the rows are changed in place and the page re-renders. private void Tick() { if (_rows.Count == 0) return; _tickWatch.Restart(); var count = Random.Shared.Next(3, 8); for (var i = 0; i < count; i++) { var row = _rows[Random.Shared.Next(_rows.Count)]; row.PreviousPrice = row.Price; var change = Math.Round(row.Price * (decimal)((Random.Shared.NextDouble() - 0.49) * 0.03), 2); if (change == 0) change = 0.05m; row.Price = Math.Max(0.50m, row.Price + change); row.TickDirection = row.Price > row.PreviousPrice ? 1 : -1; row.LastUpdated = DateTime.Now; row.Timeline.Add((double)row.Price); if (row.Timeline.Count > 24) row.Timeline.RemoveAt(0); } _lastChanged = count; _ticks++; _renderPending = true; StateHasChanged(); } protected override void OnAfterRender(bool firstRender) { if (!_renderPending) return; _renderPending = false; _lastMs = _tickWatch.Elapsed.TotalMilliseconds; _recent.Enqueue(_lastMs); while (_recent.Count > 20) _recent.Dequeue(); _ = InvokeAsync(StateHasChanged); // show the number; this render has no pending tick, so it ends here } private void Reset() { _rows = Load(); _ticks = 0; _lastChanged = 0; _lastMs = 0; _recent.Clear(); } // Seeded portfolio; no instrument has moved yet, so no price cell is tinted until the first tick. private static List Load() { var rows = BenchDataStore.GetFinanceTickers(); foreach (var row in rows) { row.TickDirection = 0; row.PreviousPrice = row.Price; } return rows; } private static string Sparkline(List points) { if (points.Count < 2) return "0,12 110,12"; var min = points.Min(); var range = Math.Max(points.Max() - min, 0.001); return string.Join(" ", points.Select((p, i) => $"{5 + i * 100.0 / (points.Count - 1):F1},{22 - (p - min) / range * 16:F1}")); } public void Dispose() { _timer?.Stop(); _timer?.Dispose(); } ``` --- # Blazor Tree Grid (TreeList) URL: https://flexcoreui.com/demo/grid/tree-grid Section: Data Grid Controls: TreeGridControl, TreeGridColumn Keywords: tree grid, treegrid, treelist, hierarchical grid, self-referencing hierarchy, lazy loading Show parent-child data in a Blazor tree grid: collapsible rows built from Id and ParentId, 4,009 airports loaded on demand, and an org chart. ## Documentation ### Data | Name | Type | Default | Description | |---|---|---|---| | DataSource | IEnumerable? | null | The flat list of rows. The hierarchy is rebuilt when a different list instance is assigned, not when the same list is mutated; both examples build a new list and remount with @key. Keys must be non-null and unique and parent links acyclic, or an ArgumentException is thrown. | | ChildContent | RenderFragment? | null | The TreeGridColumn declarations. They render into a hidden element and register themselves with the control, which draws from that list. | | IdMapping | string | "" | Name of the public property that holds each row's key, read by reflection. Empty builds no rows; a name that is not a property throws. | | ParentIdMapping | string | "" | Name of the property that holds the parent's key. Null, or a key no row has, makes the row a root. | | TreatAsParent | Func? | null | Marks a row expandable although no child is in the list, until a LoadChildren call for it has completed. Without LoadChildren such a row only gains the icon and the Expanded / Collapsed events; the first example passes it for rows that already have children. | | LoadChildren | Func>>? | null | Lazy loading: called the first time a TreatAsParent row opens, with the row and a token canceled on dispose, and must return that row's direct children (parent key equal to its key, else ArgumentException). The children join the tree and stay until a new DataSource instance arrives; a failure raises LoadFailed. | | TreeColumnIndex | int | 0 | Index, in the declared column list, of the column that carries the indent, the expand icon and the folder icon. A hidden column there falls back to the same index among the visible columns. | ### Expansion | Name | Type | Default | Description | |---|---|---|---| | EnableCollapseAll | bool | false | False builds every parent open, true every parent closed. Ignored when InitialExpansionPredicate is set: the org chart sets both and the predicate wins. | | InitialExpansionPredicate | Func? | null | Decides each parent's state when the tree is built: true open, false closed. Set, it replaces EnableCollapseAll. It runs again on every rebuild; PreserveExpansionOnDataChange then restores the states kept from the previous list. | | PreserveExpansionOnDataChange | bool | true | When a new list arrives, parents keep the state they had under the previous list, matched by key; new keys take their initial state. False gives every parent its initial state. | | ToggleOnRowClick | bool | true | A click anywhere on a parent row toggles it as well as selecting it. False leaves toggling to the icon, the keyboard and the methods; both examples turn it off. | | SpaceTogglesExpansion | bool | true | Space on the selected parent toggles it. False frees Space for OnHostKeyDown. With ShowCheckboxes, Space toggles the row's checkbox and never reaches this. | ### Icons | Name | Type | Default | Description | |---|---|---|---| | IndentPerLevel | int | 16 | Pixels of indent per level in the tree column, before the icon. With fx-treegrid-dotted-lines in CssClass each level is drawn as a connector segment of this width. | | NodeExpandIconStyle | GroupExpandIconStyle | GroupExpandIconStyle.PlusMinus | PlusMinus: a bordered + or − box, leaf rows getting a blank placeholder of the same width. Triangle: a folder image in place of the box (closed, or open with ChangeNodeIconOnExpand); its ▶ / ▼ glyphs appear only once CollapsedGlyph or ExpandedGlyph moves the row onto the glyph path. | | CollapsedGlyph | string? | null | Glyph of a closed parent in place of the preset's. Setting it, or ExpandedGlyph, puts a Triangle tree on the glyph path too. | | ExpandedGlyph | string? | null | Glyph of an open parent in place of the preset's. | | LeafGlyph | string? | null | Glyph for leaf rows in place of the blank placeholder. | | ExpandIconStyle | string? | null | Inline style of the parent icon span; null uses the PlusMinus box style, or nothing for Triangle. | | LeafIconStyle | string? | null | Inline style of the leaf placeholder or glyph span. | | ExpandIconTemplate | RenderFragment? | null | Replaces the whole parent icon; receives true when the row shows as open (while a filter is active, that means a child the filter keeps). The template handles the click itself; the control binds none. | | LeafIconTemplate | RenderFragment? | null | Replaces the leaf placeholder. | | GetNodeIcon | Func? | null | Returns an image URL for a row, or null for none, and is used instead of the folder images; the bool is true only for an open parent with ChangeNodeIconOnExpand. Leaf rows ask it only with ShowLeafNodeIcons. | | ChangeNodeIconOnExpand | bool | false | Lets the folder image, or GetNodeIcon, switch to the open form while the parent is open. False keeps it stable and leaves the state to the glyph. | | ShowLeafNodeIcons | bool | true | False drops the folder or GetNodeIcon image on leaf rows; the alignment placeholder stays. Leaves show an image only with GetNodeIcon, a folder class in CssClass or the Triangle preset. | ### Selection | Name | Type | Default | Description | |---|---|---|---| | AllowSelection | bool | true | False: no row is ever selected, so no band is painted, RowSelected never fires and the arrow keys have no current row to move from. Row clicks still toggle parents and raise RowClicked. | | SelectionMode | SelectionMode | SelectionMode.Row | Row paints the whole row. Cell highlights one cell and Left / Right move that cursor across the columns (on the tree column they still close or open the row); the root gets fx-treegrid-select-cell. One row is selected either way: the tree has no multi-select. | | RetainFocusOnActivation | bool | true | After Enter raises RowActivated the tree takes focus back. False lets the handler move focus to an editor. | | TabIndex | int | 0 | tabindex of the root element, the tree's single Tab stop; rows are tabindex -1 and are focused by the keyboard handling. | ### Checking | Name | Type | Default | Description | |---|---|---|---| | ShowCheckboxes | bool | false | Adds a 36 px checkbox column with a check-all box in the header (loaded rows only); Space toggles the selected row's box. Checks are independent of the selection. | | AutoCheckHierarchy | bool | true | Checking a parent checks its enabled descendants; a parent with some descendants checked shows mixed and becomes checked when all are. False keeps every box independent. | | CanCheckRow | Func? | null | False disables the row's box and, through it, every descendant's. | | CheckedItems | IReadOnlyList? | null | The checked rows set by the host, matched by key and re-read whenever the set of keys changes; pair with CheckedItemsChanged for @bind-CheckedItems. | ### Editing | Name | Type | Default | Description | |---|---|---|---| | EditSettingsRef | EditSettings? | null | Turns on the built-in editing: AllowAdding, AllowEditing, AllowDeleting, Mode Inline, Dialog or Batch, entry by double-click, Enter or a click on the active cell. The key and parent key columns are never editable. With it set, cell clicks take the editing path and RowClicked is not raised. Null leaves only the per-column CellEditTemplate. | | NewItemFactory | Func? | null | Creates the record for the toolbar's Add root and Add child; without it Activator.CreateInstance. The record must carry a key no row has. | | CloneFactory | Func? | null | Returns an independent copy of a record for its edit draft; without it the record is round-tripped through System.Text.Json. Records must be reference types. | | Validator | Func>? | null | Extra validation of a draft, run with the data annotations before a commit; its results join the row's messages. | | ShowEditToolbar | bool | true | The Add root / Add child / Edit row / Delete / Save changes / Cancel changes and Indent / Outdent / Move row buttons above the grid; rendered only with EditSettingsRef or AllowRowDragAndDrop. | | EditValidatorTemplate | RenderFragment? | null | Rendered with the draft's EditContext above the validation summary of the editing row or dialog. | | AllowRowDragAndDrop | bool | false | Rows can be dragged onto Before / Inside / After drop zones of another row, Ctrl+Left and Ctrl+Right outdent and indent the selected row, and the toolbar and header menu gain move commands. Blocked while edits are pending. | | CanDrop | Func, bool>? | null | Vetoes a move before RowMoving; false rejects it with an error message. | ### Query | Name | Type | Default | Description | |---|---|---|---| | AllowSorting | bool | false | Header clicks sort the siblings under each parent, so the hierarchy stays; Shift+click adds a level, and the header menu gains Custom sort and Clear sorting. Columns opt out with their own AllowSorting. | | AllowMultiSorting | bool | true | False limits Shift+click, the sort dialog and SetSortsAsync to one level. | | AllowFiltering | bool | false | Adds the header filter button and its popup (two conditions joined by And / Or). Matching rows show with their ancestors and descendants per FilterHierarchyMode; while a filter is active the open state shown is the filter's, not the user's. | | FilterHierarchyMode | TreeGridFilterHierarchyMode | TreeGridFilterHierarchyMode.Both | None shows matching rows only, Parent adds their ancestors, Child their descendants, Both both. | | FilterMatchCase | bool | false | Case-sensitive text matching. | | ShowHeaderFilterIcon | bool | true | False hides the header filter buttons; SetFilterAsync still works. | | AllowPaging | bool | false | Pages the visible rows (after expansion and filtering) by PageSize, with a Previous / Next pager under the grid; selecting a row moves to its page. | | PageSize | int | 50 | Rows per page; must be positive or OnParametersSet throws. | ### Columns | Name | Type | Default | Description | |---|---|---|---| | WidthMode | GridWidthMode | GridWidthMode.FillAvailable | FillAvailable stretches the table to the host and shares the width out; FitColumns sizes the table to the sum of the column widths, leaving slack or a horizontal scrollbar, and a resize moves only that column. | | AllowResizing | bool | false | Drag grips on the headers; a drag that changes the width raises ColumnResized, a double-click on the grip best-fits the column. | | AllowColumnAutoFit | bool | true | Best fit by grip double-click, the header menu (Best Fit, Best Fit All Columns, Best Fit to Grid) and the AutoFit methods, with GridControl's ColumnAutoFit engine. False removes all of them. | | AutoFitSampleSize | int | ColumnAutoFit.DefaultSampleSize | Rows measured for a best fit; the constant is 50. | | AutoFitMinWidth | double | ColumnAutoFit.DefaultMinWidth | Floor in px for a best-fit width; the constant is 40. | | AutoFitMaxWidth | double | 0 | Ceiling in px for a best-fit width; 0 uses the scroll surface's width. | | AutoFitUseDomMeasurement | bool | true | Measures the rendered cells through grid-control.js; false estimates from the cell text. | | FrozenColumns | int | 0 | The first n visible columns stick to the left edge. Columns can also freeze themselves (IsFrozen) or be frozen from the header menu and FreezeColumnAsync. | | ShowColumnHeaders | bool | true | False drops the header row and with it header sorting, filtering, resizing and the header menu. | | ShowHeaderContextMenu | bool | true | Right-click on a header opens the menu: freeze, best fit, move, Expand all / Collapse all, sorting and Clear filters. False lets the browser menu through. | | ShowColumnOptionsButton | bool | false | Enables the Columns panel (show or hide, with a search box), opened by a toolbar item with the Columns action or, with ShowGridOptionsRail, by a rail button. The last visible column cannot be hidden. | | ShowGridOptionsRail | bool | false | The rail button that opens the Columns panel; needs ShowColumnOptionsButton. | | Toolbar | List? | null | Toolbar items by text. ExpandAll, CollapseAll, ToggleExpandCollapse, Columns and ClearFilters (and a few aliases) run built-in actions; Refresh only gets its icon and title, and any other text is a custom key. | | ToolbarItems | IReadOnlyList? | null | Toolbar items with icon, title, action, disabled state, separators and a drop-down Items list; listed before the Toolbar texts. | | ShowGridToolbar | bool? | null | Null shows the toolbar when it has items; true or false forces it. | ### Display | Name | Type | Default | Description | |---|---|---|---| | Height | string? | null | CSS height of the root; the rows scroll inside it. Both examples use 440px. | | Width | string? | null | CSS width of the root. | | CssClass | string? | null | Classes added to the root. The control reads four of them: fx-treegrid-compact (14 px rows), fx-treegrid-yellow-folder and fx-treegrid-blue-leaf-folder (folder images beside the glyph), fx-treegrid-dotted-lines (connector segments per level, styled by the library stylesheet). | | EnableHover | bool | true | Adds fx-treegrid-hover to every row for the hover tint. | | RowCssClassSelector | Func? | null | Extra class for a row, from its record and display index; an exception from it is swallowed. | | RowDetailsTemplate | RenderFragment? | null | Content under an open row, spanning every column. A row with details counts as a parent and gets the expand icon even without children; mouse and keyboard events inside the details do not reach the row. | | RowDetailsPredicate | Func? | null | Limits the details to the rows it accepts; null gives them to every row. | | AriaLabel | string | "Tree grid" | aria-label of the table, which has role treegrid. | | ShowLegacyScrollBar | bool | false | Replaces the native vertical scrollbar with a DOM-drawn Win9x-style one that can be styled and right-clicked. | | EnableLegacyScrollBarMenu | bool | true | The Scroll Here / Top / Bottom / Page Up / Page Down / Scroll Up / Scroll Down menu on the legacy bar's right-click. | | LegacyScrollLineHeight | double | 17 | Pixels per line for the legacy bar's arrow buttons and its Scroll Up / Scroll Down commands. | ### Column | Name | Type | Default | Description | |---|---|---|---| | Field | string | "" | Property name on TValue, read by reflection; also the column's key for widths, filters and state. A column without a field is display-only: it cannot sort, filter or be hidden from the panel. | | HeaderText | string | "" | Header caption; empty shows the field name. | | Width | string? | null | CSS width; a px value is also the starting width for resizing and best fit. | | MinWidth | string? | null | CSS min-width; a px value floors a resize (otherwise 32 px) and a best fit. | | MaxWidth | string? | null | Upper bound for best fit; unset uses AutoFitMaxWidth or the pane width. | | AllowAutoFit | bool | true | False keeps the column out of Best Fit and Best Fit All Columns; Best Fit to Grid still scales it. | | Type | ColumnType | ColumnType.Text | Text, Password, Number, Date, Boolean or CheckBox. Picks the default filter operator (Contains for Text, Equals otherwise), the typed filter matching, the numeric best fit and the Date alignment default. | | TextAlign | TextAlign? | null | Cell and header alignment; unset is Right for Date columns and Left otherwise. | | Format | string? | null | Format string for IFormattable values, in the current culture; the examples use $#,##0.00, C0 and yyyy-MM-dd. | | Visible | bool | true | False hides the column; the Columns panel can override it per field. | | IsFrozen | bool | false | Sticks the column to the FrozenPosition edge; the header menu or FreezeColumnAsync override it. | | FrozenPosition | FrozenColumnPosition | FrozenColumnPosition.Left | Edge for IsFrozen. | | IsPrimaryKey | bool | false | Keeps the column out of the built-in editors. | | AllowEditing | bool | true | False keeps the column out of the built-in editors; key columns and read-only properties are out anyway. | | AllowSorting | bool | true | False keeps the column out of header-click sorting, the sort dialog and SetSortsAsync. | | AllowFiltering | bool | true | False removes the column's filter button and makes SetFilterAsync throw for it. | | AllowResizing | bool | true | False removes the column's resize grip. | | Template | RenderFragment? | null | Cell content; context is the row as object, cast it to TValue as the org chart does. In the tree column it follows the indent and icons; with a CellEditTemplate it becomes the display inside the click target. | | HeaderTemplate | RenderFragment? | null | Replaces the header caption. | | HeaderIconKind | TreeGridHeaderIconKind | TreeGridHeaderIconKind.None | ExpandAll or CollapseAll draws the matching library icon as a header button. The button only raises HeaderIconClicked; the host performs the action. | | HeaderIconSrc | string? | null | Image URL of the header icon button, overriding the kind's icon. | | HeaderIconAlt | string? | null | alt text of the header icon, and the button's aria-label when set. | | HeaderIconTitle | string? | null | Tooltip of the header icon button, and its aria-label when there is no alt. | | HeaderIconCssClass | string? | null | Extra class on the header icon button. | | HeaderIconVisible | bool | true | False hides the header icon button. | | HeaderToolbarItems | IReadOnlyList? | null | A toolbar inside the header cell with the grid toolbar's item model; built-in actions run after HeaderToolbarItemClicked unless it cancels. | | EditTemplate | RenderFragment? | null | Replaces the built-in FormItemControl editor of this column during an EditSettingsRef edit; context is the draft. Enter, Escape and Tab are handled by the control around it. | | CellEditTemplate | RenderFragment? | null | In-cell editor independent of EditSettingsRef: the cell shows its display inside a click target, a click on the current cell swaps the editor in, and F2, Enter, F4 or typing start it from the keyboard. The context also cascades as ICellEditorHost. | | CellEditPredicate | Func? | null | Rows that offer the CellEditTemplate; the others render plain. | | CellEditDisplayCssClass | string? | null | Extra class on the click target, whose base class is fx-treegrid-cell-edit-display. | ### Column events | Name | Type | Description | |---|---|---| | HeaderIconClicked | | The header icon button was clicked; the control takes no action of its own. | | HeaderToolbarItemClicked | GridToolbarClickEventArgs | A header toolbar item was clicked, before its built-in action; Cancel skips the action. IsHeaderToolbar is true and ColumnField / ColumnHeader name the column. | ### Events | Name | Type | Description | |---|---|---| | RowSelected | TreeRowSelectEventArgs | After a row becomes selected: click, expand-icon click, arrow keys, Home / End, a subscribed right-click, SelectRecordAsync, or a property grid taking focus. Raised again by a click on the already selected row; never with AllowSelection off. | | RowDeselected | TreeRowSelectEventArgs | Before RowSelected whenever one selection replaces another, and from ClearSelectionAsync and SelectRecordAsync(null). The payload carries Data; only ClearSelectionAsync sets RowIndex. GridControl declares this event and never raises it; the tree does. | | RowClicked | TreeRowClickEventArgs | A pointer click on a row, after selection and focus, with the MouseEventArgs; raised even with AllowSelection off. Not raised when EditSettingsRef is set, because cell clicks then stop at the editing path. | | RowDoubleClicked | TreeRowSelectEventArgs | Double-click on a row. With EditSettingsRef.AllowEditing and AllowEditOnDblClick the double-click starts an edit instead. Also Enter's fallback when RowActivated has no handler. | | RowRightClicked | TreeRowSelectEventArgs | Right-click: the row is selected first, then the event fires; the browser contextmenu event still bubbles. Without a handler a right-click changes nothing. | | RowActivated | TreeRowSelectEventArgs | Enter on the selected row, which keeps its state; with no selection Enter selects the first row instead. Not raised when Enter is an edit key: EditSettingsRef with EditOnEnterKey (its default), or a CellEditTemplate on the current cell. | | OnHostKeyDown | KeyboardEventArgs | Every keydown on the root while no editor is open, before the built-in navigation. Keys the control consumes first (F2, Enter into an editor, Space on a checkbox row, Ctrl+Left / Ctrl+Right with drag-and-drop) do not reach it. | | Expanded | TreeNodeEventArgs | After a parent opens by icon, row click, Space, Right, SetExpandedAsync or a finished child load. Not raised by ExpandAllAsync, ExpandAtLevelAsync, RestoreStateAsync or the toolbar's expand actions, which set the state directly. | | Collapsed | TreeNodeEventArgs | After a parent closes by icon, row click, Space, Left or SetExpandedAsync; the same exclusions as Expanded. | | CheckedItemsChanged | IReadOnlyList | The checked rows (mixed parents excluded) after a box or Space, CheckAllAsync, SetRowCheckedAsync, a commit, a child load or RestoreStateAsync. | | LoadFailed | string | The exception message when LoadChildren throws; the node closes again and an alert under the grid shows the same text. | | EditStarting | TreeGridEditEventArgs | Before a row enters editing or a new row is added: Original (null for a new row), the Draft and its EditContext; Cancel refuses. | | DataChanging | TreeGridDataChangeEventArgs | Before a save or a move replaces the records, with the list of Add / Update / Delete / Move changes. Cancel, or an Error text, aborts and shows the error. | | DataChanged | TreeGridDataChangeEventArgs | After the records are replaced, with the same args. | | DataSourceChanged | IEnumerable | The new full record list after a commit, for @bind-DataSource; a list handed back this way is recognized as the control's own publication and does not reset its editing state. | | RowMoving | TreeGridRowMoveEventArgs | Before a move is committed (drag, Indent / Outdent, the Move row dialog, MoveRowAsync), after CanDrop; Cancel or Error aborts. | | RowMoved | TreeGridRowMoveEventArgs | After the move, with the moved record and its target. | | SortChanged | IReadOnlyList | After SetSortsAsync, which header clicks, the sort dialog and Clear sorting go through; the full ordered list. | | PageChanged | int | After GoToPageAsync (the pager, RestoreStateAsync), with the 1-based page. A selection or an edit that lands on another page changes the page without raising it. | | ColumnResized | ResizeEventArgs | After a grip drag that changed a width, and once per column a best fit changed: Field, OldWidth and NewWidth in px. | | ToolbarItemClicked | GridToolbarClickEventArgs | A grid toolbar click, before its built-in action; Cancel skips the action. Header toolbar clicks go to the column's HeaderToolbarItemClicked instead. | | OnToolbarItemClick | string | After the action, with the item's Key; grid toolbar only. | | LegacyScrollBarRightClicked | MouseEventArgs | Right-click on the legacy scrollbar, before its own menu. | ### Row args | Name | Type | Default | Description | |---|---|---|---| | Data | TValue? | null | The row. | | RowIndex | int | 0 | Index in the current display order, all pages counted. | | Level | int | 0 | Depth, 0 for a root. | | HasChildren | bool | false | The row is a parent: children present, TreatAsParent, or a details template. | | IsExpanded | bool | false | The row's open state at the time of the event. | | MouseEvent | MouseEventArgs | new() | TreeRowClickEventArgs only: the click's MouseEventArgs. | ### Node args | Name | Type | Default | Description | |---|---|---|---| | Data | TValue? | null | The parent that opened or closed. | | Level | int | 0 | Its depth, 0 for a root; the first example prints both. | ### Edit args | Name | Type | Default | Description | |---|---|---|---| | Original | T? | | The record being edited; null for a new row. | | Draft | T | | The copy the editors bind to. | | EditContext | EditContext | | The draft's form context, with data annotations enabled. | | IsNew | bool | | True for Add root, Add child and AddRecordAsync. | | Cancel | bool | false | Set in EditStarting to refuse the edit. | ### Change args | Name | Type | Default | Description | |---|---|---|---| | Changes | IReadOnlyList> | | One TreeGridRowChange per row: Kind Add, Update, Delete or Move, Original and Data. | | Cancel | bool | false | Set in DataChanging to abort; ignored by DataChanged. | | Error | string? | null | Message shown under the grid when the change is refused; setting it aborts on its own. | ### Move args | Name | Type | Default | Description | |---|---|---|---| | Item | T | | The row being moved. | | Target | T | | The row it is dropped on. | | Position | TreeDropPosition | | Before, Inside or After the target. | | Cancel | bool | false | Set in RowMoving to refuse; ignored by RowMoved. | | Error | string? | null | Message shown when the move is refused; setting it aborts on its own. | ### Resize args | Name | Type | Default | Description | |---|---|---|---| | Field | string | "" | The column key: its field, or its header for a field-less column. | | OldWidth | double | 0 | Width in px before the change. | | NewWidth | double | 0 | Width in px after it. | | Cancel | bool | false | Declared, but TreeGridControl never reads it. | ### Toolbar args | Name | Type | Default | Description | |---|---|---|---| | Key | string | "" | The item's key: its text, or the action name, when none was given. | | Action | GridToolbarAction | GridToolbarAction.Custom | The resolved built-in action, or Custom. | | Item | GridToolbarItem? | null | The item as resolved for rendering. | | IsHeaderToolbar | bool | false | True for a column header toolbar. | | ColumnField | string? | null | The header toolbar's column field; null for the grid toolbar. | | ColumnHeader | string? | null | The header toolbar's column caption. | | Cancel | bool | false | Set to skip the built-in action; OnToolbarItemClick is then not raised either. | ### Methods | Name | Type | Description | |---|---|---| | GetVisibleRecords() | IReadOnlyList | Rows in display order: expansion, sorting and filtering applied, all pages. | | SetExpandedAsync(TValue? item, bool expanded) | Task | Opens or closes one parent, loading its children first when needed; raises Expanded or Collapsed. | | ExpandAllAsync() | Task | Opens every parent in one pass without raising Expanded; lazy parents load after the render. A pending built-in edit must validate first. Wired to the Expand all button. | | CollapseAllAsync() | Task | Closes every parent without raising Collapsed; wired to the Collapse all button. | | ExpandAtLevelAsync(int level) | Task | Opens the parents at 0-based levels up to and including level, without events. | | CollapseAtLevelAsync(int level) | Task | Closes the parents at that level and deeper, without events. | | GetSelectedRecord() | TValue? | The selected row, or default. | | SelectRecordAsync(TValue? item) | Task | Selects a row from code (null clears), raising RowDeselected and, when the item is in the tree, RowSelected. Does not scroll to it or open its ancestors. | | ClearSelectionAsync() | Task | Clears the selection; RowDeselected carries the row and its index. | | FocusAsync(bool preventScroll = true) | Task | Focuses the root element. | | ClearActiveCellEdit() | void | Ends an open CellEditTemplate edit; a no-op in the cursor phase. | | RenameNodeAsync(object id, string field, string text) | Task | Writes a string property of a loaded record in place, without a rebuild, events or validation. False when the row is gone, being edited or deleted; throws for a key column or a non-string field. | ### Edit methods | Name | Type | Description | |---|---|---| | GetCheckedRecords() | IReadOnlyList | The checked rows; mixed parents are not included. | | SetRowCheckedAsync(object id, bool value) | Task | Checks or unchecks a row by key, cascading per AutoCheckHierarchy; raises CheckedItemsChanged. | | CheckAllAsync(bool value = true) | Task | Checks or unchecks every loaded row, collapsed, filtered and paged ones included; disabled branches are skipped. | | GetCurrentRecords() | IReadOnlyList | The loaded records, lazily loaded children included, as last committed; pending drafts and deletions are not applied. | | BeginEditAsync(object id, string? field = null) | Task | Starts the built-in edit of a visible row, in the first editable column when field is null. False when editing is off, the row is hidden or EditStarting cancels. | | AddRecordAsync(TValue item, object? parentId = null) | Task | Adds a draft under parentId (null: a root) and opens its editor; the item's key must be new. | | SaveChangesAsync() | Task | Validates every draft, raises DataChanging, replaces the records and raises DataSourceChanged and DataChanged. False on a validation error or a cancel. | | CancelChangesAsync() | Task | Discards every draft and pending deletion. | | CancelEditAsync() | Task | Discards the draft of the row being edited only. | | DeleteRecordsAsync(IEnumerable ids) | Task | Deletes the rows and their descendants: at once, or as pending changes in Batch mode. | | MoveRowAsync(object sourceId, object targetId, TreeDropPosition position = TreeDropPosition.Inside) | Task | Moves a row and its branch before, inside or after another. Needs AllowRowDragAndDrop, no pending edits and, for reordering siblings, no sort; raises RowMoving, the data events and RowMoved. | | IndentAsync(object id) | Task | Moves the row inside its previous sibling. | | OutdentAsync(object id) | Task | Moves the row after its parent. | ### Query methods | Name | Type | Inputs | Description | |---|---|---|---| | AddColumn(TreeGridColumn column) / RemoveColumn(TreeGridColumn column) | void | | Column registration; TreeGridColumn calls them itself when it initializes and disposes. | | FreezeColumnAsync(string field, FrozenColumnPosition? position) | Task | | Freezes a column left or right, or unfreezes it with null; throws for an unknown field. | | AutoFitColumnsAsync() | Task | | Best-fits every visible column to its content. | | AutoFitColumnAsync(string field) | Task | | Best-fits one column, by field or by header for a field-less column. | | FitColumnsToGridAsync() | Task | | Scales the visible columns proportionally so together they fill the width exactly. | | GetSorts() | IReadOnlyList | | The sort levels in priority order. | | SetSortsAsync(IEnumerable sorts) | Task | | Replaces the sort levels (empty clears) and raises SortChanged. Throws for a repeated or non-sortable field, or several levels with AllowMultiSorting off. | | OpenSortDialogAsync() | Task | | Opens the Custom sort dialog; needs AllowSorting. | | GetFilters() | IReadOnlyList | | The active filters, one per column. | | SetFilterAsync(TreeGridFilter filter) | Task | | Sets one column's filter (field, operator, value, optional second condition and And / Or) and returns to page 1; throws for a non-filterable field. | | ClearFiltersAsync() | Task | | Clears every column filter. | | GoToPageAsync(int page) | Task | | Moves to a page, clamped to the range, and raises PageChanged. | | CaptureState() | TreeGridViewState | | Sorts, filters, expanded and selected keys, filter mode and case, page and page size, column visibility and widths, frozen columns and checked keys, with keys as invariant strings. | | RestoreStateAsync(TreeGridViewState state) | Task | | Applies a captured state: sorts are validated first, then filters, expansion, selection, columns, checks and the page, which raises PageChanged. | | Export() | GridExportResult | GridExportFormat formatstring fileName = "Tree"bool allLoaded = false | The visible rows of every page or, with allLoaded, every loaded row, in the chosen GridExportFormat, with a Level column first and parents in bold. Children not yet loaded are not fetched. | | DownloadAsync() | Task | GridExportFormat formatstring fileName = "Tree"bool allLoaded = false | Export, then hands the file to the browser. | ### Props | Name | Type | Description | |---|---|---| | HasExpandableNodes | bool | Any parent in the tree. | | AreAllExpandableNodesExpanded | bool | Every parent is open; drives the toolbar's ToggleExpandCollapse icon. | | HasPendingChanges | bool | Drafts or pending deletions exist. | | CurrentEditContext | EditContext? | The EditContext of the row being edited, or null. | | CurrentPage | int | The 1-based page, clamped to PageCount. | | PageCount | int | Pages of visible rows at the current PageSize; at least 1. | ## Examples ### Org ```razor @using Fx.ControlKit @using Fx.ControlKit.Grid

@OrgStatus

``` ```csharp // Org chart: Razor Sharp Getaways' staff (Data/TravelOrg.cs). A search keeps every match's managers, so the tree stays // rooted. private static readonly IReadOnlyList _staff = TravelOrg.Staff; private static readonly Dictionary _byId = _staff.ToDictionary(p => p.Id); private string? _search; private List _shown = _staff.ToList(); private int _orgGeneration = 1; // @key: a new value remounts the tree grid when the list is swapped private string OrgStatus => $"{_shown.Count:N0} of {_staff.Count:N0} posts shown; {_shown.Count(p => p.Vacant)} vacant, {_shown.Count(p => p.OnLeave)} on leave."; private static string DottedLine(StaffMember p) => p.DottedLineId is { } id ? _byId[id] is { Vacant: true } v ? $"{v.Title} (vacant)" : _byId[id].Name : ""; private void Search(string? text) { _search = text?.Trim(); var keep = _staff .Where(p => string.IsNullOrEmpty(_search) || new[] { p.Name, p.Title, p.Office, p.Division, p.Department }.Any(v => v.Contains(_search, StringComparison.OrdinalIgnoreCase))) .Select(p => p.Id) .ToHashSet(); foreach (var id in keep.ToList()) for (var manager = _byId[id].ManagerId; manager is not null && keep.Add(manager); manager = _byId[manager].ManagerId) { } _shown = _staff.Where(p => keep.Contains(p.Id)).ToList(); _orgGeneration++; } // Data/TravelOrg.cs: one post; TravelOrg.Staff generates the list from a fixed seed. public sealed record StaffMember { public required string Id { get; init; } public string? ManagerId { get; init; } public string? DottedLineId { get; init; } public required string Name { get; init; } // "Vacant" for an open post public required string Title { get; init; } public int Grade { get; init; } // 1 trainee to 9 chief executive public required string Division { get; init; } public required string Department { get; init; } public required string Office { get; init; } public required string Country { get; init; } public required string Region { get; init; } public required string Contract { get; init; } // Permanent, Fixed-term, Seasonal or Contractor public double Fte { get; init; } = 1; // 1 full time; 0.5 to 0.8 part time public DateOnly? Started { get; init; } public decimal Salary { get; init; } // USD a year at the post's FTE; the budget for a vacant post public int? Rating { get; init; } // 1 to 5; none for vacant posts and people who started under six months ago public string Languages { get; init; } = ""; public string Email { get; init; } = ""; public bool Vacant { get; init; } public bool OnLeave { get; init; } public int Level { get; init; } // 0 for the chief executive public int DirectReports { get; init; } // posts reporting on the solid line, vacant ones included public int Headcount { get; init; } // people below on the solid line, vacant posts not counted } ``` ### Airports ```razor @using Fx.ControlKit.Grid

@_loaded.ToString("N0") of @_total.ToString("N0") rows loaded@(_last is null ? "" : $" · last {_last}")

``` ```csharp // Airports: the six continents are the whole DataSource; LoadChildren supplies the rest a level at a time. // A row's Id is its path, "Europe|PT|LIS|03/21", so the loader can tell from it what to return. private TreeGridControl? _places; private readonly List _continents = AirportData.Airports .GroupBy(a => a.Continent) .OrderBy(g => g.Key) .Select(g => Group(g.Key, null, g.Key, g)) .ToList(); private int _loaded = 6; private readonly int _total = 6 + AirportData.Airports.Select(a => (a.Continent, a.CountryCode)).Distinct().Count() + AirportData.Airports.Count + AirportData.Airports.Sum(a => a.Runways); private string? _last; private Task> LoadPlacesAsync(Place parent, CancellationToken token) { var path = parent.Id.Split('|'); IReadOnlyList children = path.Length switch { 1 => AirportData.Airports.Where(a => a.Continent == path[0]) .GroupBy(a => (a.CountryCode, a.Country)) .OrderBy(g => g.Key.Country) .Select(g => Group($"{parent.Id}|{g.Key.CountryCode}", parent.Id, g.Key.Country, g)) .ToList(), 2 => AirportData.Airports.Where(a => a.Continent == path[0] && a.CountryCode == path[1]) .OrderBy(a => a.Type).ThenBy(a => a.Code) .Select(a => new Place($"{parent.Id}|{a.Code}", parent.Id, $"{a.Code} · {a.Name}", $"{a.Type} airport", null, a.Runways, a.LongestRunwayFt, a.ElevationFt)) .ToList(), _ => AirportData.RunwaysOf(path[2]).Where(r => !r.Closed) .OrderByDescending(r => r.LengthFt) .Select(r => new Place($"{parent.Id}|{r.Name}", parent.Id, $"Runway {r.Name}", r.Lighted ? $"{r.Surface}, lighted" : r.Surface, null, null, r.LengthFt, null)) .ToList() }; _loaded += children.Count; return Task.FromResult(children); } private static Place Group(string id, string? parentId, string name, IEnumerable airports) => new(id, parentId, name, "", airports.Count(), airports.Sum(a => a.Runways), airports.Max(a => a.LongestRunwayFt), null); private sealed record Place(string Id, string? ParentId, string Name, string Detail, int? Airports, int? Runways, int? LongestRunwayFt, int? ElevationFt) { public int Level => Id.Count(c => c == '|'); } ``` --- # Blazor Master-Detail Grid URL: https://flexcoreui.com/demo/grid/master-detail Section: Data Grid Controls: GridControl, GridColumn, GridControlEvents Keywords: master-detail, hierarchy grid, detail template, row detail, drill-down Master-detail in Blazor: pick one of 233 countries to list its airports, or open a row under a product to see its stock by warehouse. ## Documentation ### Grid | Name | Type | Default | Description | |---|---|---|---| | AllowSelection | bool | true | False makes the grid cursor-only: clicks and keys still move the active cell, editing and the click events still work, but nothing is ever selected and no selection event fires. | | AutoSelectFirstRow | bool | false | Selects the first visible row when a selectable grid first receives rows, and again after a sort changes the order. Raises RowSelected but not RowSelecting. Skipped in Cell mode and with CheckboxOnly. | | InitialSelectedRowIndex | int? | null | Displayed-row index to select before the first paint, for pickers that already know their value. Applied again when the data source or the index changes. | | HighlightSelectedRows | bool | true | False keeps the selection and its events but does not paint the selected rows. | | SelectionSettingsRef | SelectionSettings? | null | The settings object below. Null behaves as single row selection. | | EventsRef | GridControlEvents? | null | The object that holds the callbacks; the grid has no separate parameters for the selection events. | ### Settings | Name | Type | Default | Description | |---|---|---|---| | Type | SelectionType | SelectionType.Single | Single keeps one row; Ctrl or Shift with a click or an arrow still extends it unless ModifierKeysExtendSelection is off. Multiple: a plain click still collapses to the clicked row; Ctrl toggles a row, Shift selects the visible range from the last selected row. | | Mode | SelectionMode | SelectionMode.Row | Row or Cell. In Cell mode the selected set is cells, SelectionChanged counts cells, and AutoSelectFirstRow is skipped. | | ShowCheckboxes | bool | false | Adds the selection checkbox column while ordinary clicks still select. | | CheckboxOnly | bool | false | Only the checkboxes change the selection; a click on a cell does not, and AutoSelectFirstRow is skipped. | | ModifierKeysExtendSelection | bool | true | With Single, Ctrl or Shift plus a click or Shift plus an arrow add rows. False keeps exactly one row: a modifier click selects the clicked row alone. Ignored for Multiple and for Cell mode. | | MultiSelectBehavior | GridMultiSelectBehavior | GridMultiSelectBehavior.FullMultiSelect | With BatchEditBehavior = MultiRow and several rows selected, FullMultiSelect keeps the selection when a plain click lands on an editable, template or command cell inside it, so a bulk edit stays armed; VBMultiSelect lets that click collapse to the clicked row. Ctrl, Shift and drag build multi-row selections in both. | | EnableToggle | bool | true | Declared, but GridControl never reads it. | | PersistSelection | bool | false | Declared, but GridControl never reads it. | ### Events | Name | Type | Description | |---|---|---| | RowSelecting | RowSelectEventArgs | Before a row is selected by mouse, keyboard or checkbox toggle. Set Cancel to refuse. Not raised by AutoSelectFirstRow, type-ahead moves or the selection methods. | | RowSelected | RowSelectEventArgs | After a row is selected by mouse, keyboard, checkbox toggle, type-ahead search or AutoSelectFirstRow. Not raised during drag-select or by the selection methods. | | SelectionChanged | int | After any change to the selected set: click, drag-select, Select All, Clear, the selection methods. The payload is the selected count, rows or cells by Mode. | | SelectionChangedDetailed | GridSelectionChangedArgs | Same timing, with Count and Source: Pointer, MouseDrag, Keyboard, Programmatic or Unknown. | | RowDeselecting / RowDeselected | RowSelectEventArgs | Declared, but GridControl never raises them. TreeGridControl raises RowDeselected. | ### Args | Name | Type | Default | Description | |---|---|---|---| | Data | TValue? | null | The row. | | RowIndex | int | 0 | The row's index in the grid's current display order. | | Cancel | bool | false | Set in RowSelecting to keep the current selection. Ignored by RowSelected. | ### Methods | Name | Type | Description | |---|---|---| | GetSelectedRecords() | IEnumerable | The selected rows, in selection order. | | GetSelectedRecordsAsync() | Task> | The same as a list. | | SelectRow(int rowIndex) | void | Selects the displayed row at that index; with Single it replaces the selection, otherwise it adds. | | SelectRowIndexAsync(int rowIndex) | Task | SelectRow as a task. | | SelectAndRevealRowAsync(TValue item, bool clearExistingSelection = false) | Task | Selects the row and scrolls it into view when it is off-screen, in one paint. | | ClearSelection() | void | Clears rows and cells. | | ClearSelectionAsync() | Task | ClearSelection as a task. | ### Detail | Name | Type | Default | Description | |---|---|---|---| | DetailTemplate | RenderFragment? | null | Content for a full-width row under a data row while that row is open; context is the row. With a template set the grid renders every row of the current page rather than a scrolling window, and a flat ItemsProvider throws at start-up. | | ExpandMode | GridExpandMode | GridExpandMode.Multiple | Multiple keeps any number of rows open. Single closes the open row when another opens, without raising RowCollapse for it. | | ShowExpandColumn | bool | true | The 36 px arrow column at the left of every row. False leaves opening and closing to the methods. | | ShowExpandAll | bool | false | An arrow in the header of that column that opens or closes every row of the page; shown only with Multiple. | ### Detail events | Name | Type | Description | |---|---|---| | RowExpand | TValue | After a row opens by its arrow, ExpandRow or ToggleRowExpand. Not raised by ExpandAll or the header arrow. | | RowCollapse | TValue | After a row closes by its arrow, CollapseRow or ToggleRowExpand. Not raised by CollapseAll, the header arrow, or Single mode replacing the open row. | ### Detail methods | Name | Type | Description | |---|---|---| | ExpandRow(TValue item) | Task | Opens the row; in Single mode the open row closes first. | | CollapseRow(TValue item) | Task | Closes the row. | | ToggleRowExpand(TValue item) | Task | One or the other, by the row's state. | | ExpandAll() / CollapseAll() / ToggleExpandAll() | void | Every row of the current page, without the row events. | | IsRowExpanded(TValue item) | bool | Whether the row is open. | | AllRowsExpanded | bool | Property: every row of the current page is open. | ## Examples ### Countries ```razor @using Fx.ControlKit.Grid

Countries

Airports in @(_country?.Name ?? "…")

@_countryAirports.Count.ToString("#,##0") airports in @(_country?.Name ?? "no country"), @_countryAirports.Count(a => a.Type == "Large") of them large.

``` ```csharp // Countries: one row per ISO code, most airports first; the airports are the detail rows. private readonly List _countries = AirportData.Airports .GroupBy(a => (a.CountryCode, a.Country)) .Select(g => new CountryRow(g.Key.CountryCode, g.Key.Country, g.Count())) .OrderByDescending(c => c.Airports).ThenBy(c => c.Name) .ToList(); private List _countryAirports = []; private CountryRow? _country; private readonly SelectionSettings _singleRow = new() { Mode = SelectionMode.Row, Type = SelectionType.Single }; private readonly GridControlEvents _countryEvents = new(); protected override void OnInitialized() { _countryEvents.RowSelected = EventCallback.Factory.Create>(this, args => Show(args.Data)); Show(_countries.FirstOrDefault()); } private void Show(CountryRow? country) { _country = country; _countryAirports = country is null ? [] : AirportData.Airports.Where(a => a.CountryCode == country.Code).ToList(); } private sealed record CountryRow(string Code, string Name, int Airports); ``` ### Warehouses ```razor @using Fx.ControlKit @using Fx.ControlKit.Grid
@product.WarehouseDetails.Count warehouses hold @product.TotalOnHand.ToString("#,##0") on hand, @product.TotalReserved.ToString("#,##0") reserved, @product.WarehouseDetails.Sum(w => w.IncomingShipmentQty).ToString("#,##0") incoming. Receive next shipment Reserve 10

@Shown.Count products worth @Shown.Sum(p => p.InventoryValuation).ToString("C0") on hand@(_open is null ? "; no detail open." : $"; {_open.SKU} open.")

``` ```csharp private GridControl? _grid; private readonly List _products = BenchDataStore.GetInventoryProducts(); private List? _shown; private List Shown => _shown ??= _products.ToList(); private SelectionItem[]? _categoryItems; private SelectionItem[] CategoryItems => _categoryItems ??= [new("All", "All"), .. _products.Select(p => p.Category).Distinct().Select(c => new SelectionItem(c, c))]; private string _category = "All"; private InventoryProduct? _open; private async Task Filter(IReadOnlyList values) { if (values.Count == 0) return; _category = values[0]; _shown = _category == "All" ? _products.ToList() : _products.Where(p => p.Category == _category).ToList(); if (_open is not null && !_shown.Contains(_open) && _grid is not null) await _grid.CollapseRow(_open); } private void Opened(InventoryProduct product) => _open = product; private void Closed(InventoryProduct product) { if (ReferenceEquals(_open, product)) _open = null; } private static void Receive(InventoryProduct product) { var stock = product.WarehouseDetails.MaxBy(w => w.IncomingShipmentQty); if (stock is null || stock.IncomingShipmentQty == 0) return; stock.QuantityOnHand += stock.IncomingShipmentQty; product.TotalOnHand += stock.IncomingShipmentQty; stock.IncomingShipmentQty = 0; } private static void Reserve(InventoryProduct product) { var stock = product.WarehouseDetails.FirstOrDefault(w => w.AvailableQuantity >= 10); if (stock is null) return; stock.ReservedQuantity += 10; product.TotalReserved += 10; } // Data/ScenarioModels.cs public sealed class InventoryProduct { public string SKU { get; set; } = ""; public string ProductName { get; set; } = ""; public string Category { get; set; } = ""; public int TotalOnHand { get; set; } public int TotalReserved { get; set; } public int AvailableStock => TotalOnHand - TotalReserved; public int ReorderPoint { get; set; } public decimal UnitCost { get; set; } public decimal InventoryValuation => TotalOnHand * UnitCost; public string StockStatus => AvailableStock <= 0 ? "Out of Stock" : AvailableStock <= ReorderPoint ? "Low Stock" : "In Stock"; public List WarehouseDetails { get; set; } = new(); } // Data/ScenarioModels.cs public sealed class WarehouseStock { public string WarehouseCode { get; set; } = ""; public string WarehouseName { get; set; } = ""; public string LocationBin { get; set; } = ""; public int QuantityOnHand { get; set; } public int ReservedQuantity { get; set; } public int AvailableQuantity => QuantityOnHand - ReservedQuantity; public int IncomingShipmentQty { get; set; } public DateTime NextDeliveryDate { get; set; } public string BatchLotNumber { get; set; } = ""; } ``` --- # Blazor Grid with 100,000 Rows URL: https://flexcoreui.com/demo/grid/row-selection-50k Section: Data Grid Controls: GridControl, GridColumn Keywords: virtualization, virtual scrolling, large data, 100k rows, row windowing, performance Scroll 1,000 to 100,000 rows in a Blazor grid that renders only the rows in view, with the server time of each run measured. ## Documentation ### Grid | Name | Type | Default | Description | |---|---|---|---| | WindowOverscanRows | int | 60 | Rows rendered beyond the visible slice on each side, so a fast flick does not outrun the render. The ceiling when the cell budget is active. | | WindowOverscanCellBudget | int | 900 | Per-side overscan budget in cells (rows × visible columns). The effective overscan is the budget divided by the visible columns, clamped between min(15, WindowOverscanRows) and WindowOverscanRows. 0 turns the budget off, as on this page. | | EnableGroupedRowWindowing | bool | true | Windows grouped grids too. Off renders every grouped row. | | MinimumRowsForWindowing | int | 0 | Source row count below which the grid does not window. 0 windows at any size. | | AllowGrouping | bool | false | Lets the user group by a column; the group drop area appears above the header. | | GroupColumns | List? | null | Initial group columns, by field name. | | ShowGroupExpandCollapse | bool | true | Expand all / collapse all toggle in the group drop area. | | EnableTypeSearch | bool | false | With the grid focused, printable keys search the active column for the first row whose text starts with the typed buffer. | | ShowRowSelectionEditColumnCue | bool | false | In row-selection grids, highlights the editable target column across the selected rows. | | ShowRowCountInFooter | bool | false | A compact row count under the grid: the complete filtered result, not the rendered window. | | SelectionSettingsRef | SelectionSettings? | null | Selection options object; see the next table. | | EditSettingsRef | EditSettings? | null | Editing options object. Batch mode here, so edits are kept until the batch is saved. | | EventsRef | GridControlEvents? | null | Event callbacks object; two of them are wired here. | ### Selection | Name | Type | Default | Description | |---|---|---|---| | Type | SelectionType | Single | Single or Multiple rows. | | Mode | SelectionMode | Row | Row or Cell selection. | ### Events | Name | Type | Description | |---|---|---| | SelectionChanged | int | After the selection changes, with the number of selected rows. | | OnCellSave | CellSaveArgs | After a cell's new value has been written to its row: a real change, or an editor the user touched. Carries the row, the column field and the value. | ## Examples ### Rows ```razor @using System.Diagnostics @using Fx.ControlKit @using Fx.ControlKit.Grid Group by Category Window grouped rows

@Summary

``` ```csharp public class SRow { public string Item { get; set; } = ""; public string Description { get; set; } = ""; public string Category { get; set; } = ""; public decimal Qty { get; set; } public decimal UnitCost { get; set; } public bool Active { get; set; } public string Season { get; set; } = ""; public string Currency { get; set; } = ""; public string Board { get; set; } = ""; public string Desk { get; set; } = ""; public string Supplier { get; set; } = ""; public string Ref { get; set; } = ""; } private readonly SelectionItem[] _rowCountItems = { new("1000", "1,000"), new("5000", "5,000"), new("20000", "20,000"), new("50000", "50,000"), new("100000", "100,000") }; private readonly SelectionItem[] _overscanItems = { new("15", "15 rows"), new("60", "60 rows"), new("260", "260 rows") }; private List _rows = []; private int _rowCount = 5000; private int _overscan = 60; private List _groupColumns = ["Category"]; private bool _groupedWindowing = true; private int _mountGen; // @key: every switch remounts the grid, so each timing starts from an empty grid private readonly SelectionSettings _selection = new() { Type = SelectionType.Multiple, Mode = SelectionMode.Row }; private readonly EditSettings _edit = new() { AllowEditing = true, Mode = EditMode.Batch }; private readonly GridControlEvents _events = new(); // Timings: build is the C# loop; render is from the click to the component's next OnAfterRender, i.e. the server side of // the first render after the swap. Browser layout and paint are not included. private readonly Stopwatch _swap = new(); private bool _swapPending; private double _buildMs, _renderMs; private int _selectedCount, _editCount; private string Summary => $"{_rowCount:N0} rows built in {_buildMs:0.0} ms; first render after the swap took {_renderMs:0} ms on the server; " + $"{_selectedCount} selected; {_editCount} edit{(_editCount == 1 ? "" : "s")} saved."; protected override void OnInitialized() { _events.SelectionChanged = EventCallback.Factory.Create(this, count => { _selectedCount = count; StateHasChanged(); }); _events.OnCellSave = EventCallback.Factory.Create>(this, _ => { _editCount++; StateHasChanged(); }); Rebuild(); } protected override void OnAfterRender(bool firstRender) { if (!_swapPending) return; _swapPending = false; _renderMs = _swap.Elapsed.TotalMilliseconds; _ = InvokeAsync(StateHasChanged); // show the number; this render has no pending swap, so it ends here } private void Rebuild() { var sw = Stopwatch.StartNew(); var categories = new[] { "Flights", "Hotels", "Transfers", "Excursions", "Cruises", "Rail", "Insurance", "Car rental" }; var seasons = new[] { "Summer", "Fall", "Winter", "Spring" }; var currencies = new[] { "EUR", "USD", "GBP" }; var boards = new[] { "Room only", "Bed and breakfast", "Half board", "All inclusive" }; var desks = new[] { "Boston", "Lisbon", "Kyoto", "Cape Town", "Manila" }; var rand = new Random(77); var list = new List(_rowCount); for (var i = 1; i <= _rowCount; i++) { var cat = categories[i % categories.Length]; list.Add(new SRow { Item = $"ITM-{i:D6}", Description = $"{cat} rate line #{i}", Category = cat, Qty = rand.Next(1, 100), UnitCost = Math.Round((decimal)(rand.NextDouble() * 180 + 12), 2), Active = i % 5 != 0, Season = seasons[i % 4], Currency = currencies[i % 3], Board = boards[i % 4], Desk = desks[i % 5], Supplier = $"Supplier {i % 97 + 1:D2}", Ref = $"RSG-{i:D6}", }); } _rows = list; _buildMs = sw.Elapsed.TotalMilliseconds; Remount(); } private void Remount() { _mountGen++; _selectedCount = 0; _swap.Restart(); _swapPending = true; } private void PickRowCount(IReadOnlyList values) { if (values.Count == 0) return; _rowCount = int.Parse(values[0]); Rebuild(); } private void PickOverscan(IReadOnlyList values) { if (values.Count == 0) return; _overscan = int.Parse(values[0]); Remount(); } private void SetGrouped(bool on) { _groupColumns = on ? ["Category"] : []; Remount(); } private void SetGroupedWindowing(bool on) { _groupedWindowing = on; Remount(); } ``` --- # Batch Editing in a Blazor Grid URL: https://flexcoreui.com/demo/grid/batch-editing Section: Data Grid Controls: GridControl, GridColumn, GridEditSettings Keywords: batch editing, cell editing, in-cell editing, inline editing, grid editing, validation Edit a Blazor grid like a spreadsheet: double-click a cell on a 5,000-line rate card, type, and Enter or Tab writes the value to your object. ## Documentation ### Grid | Name | Type | Default | Description | |---|---|---|---| | EditSettingsRef | EditSettings? | null | The settings object below. Null leaves every cell read-only: each way into an editor first checks AllowEditing on it. | | EventsRef | GridControlEvents? | null | The object that holds the callbacks below; the grid has no separate parameters for the edit events. | | BatchEditBehavior | GridBatchEditBehavior | GridBatchEditBehavior.MultiRow | Picks one of the two batch behaviors in the table below. | | EditOnSingleClick | bool | false | A plain click on an editable batch cell opens its editor at once, instead of only selecting the cell. | | CellEditablePredicate | Func? | null | Per-row veto, called with the row and the field before a cell opens and again for each row a multi-row commit fans out to. A false answer leaves that cell read-only without raising OnCellEdit. | | NewItemFactory | Func? | null | Builds the row for AppendRow, InsertRow and the Inline or Dialog add editor. Without it the grid calls Activator.CreateInstance(). | | AllowSingleCellColumnMassEdit | bool | false | With SingleCell and cell selection, Ctrl or Shift can select several cells of one column, and a typed value commits to all of them. | ### Settings | Name | Type | Default | Description | |---|---|---|---| | AllowEditing | bool | false | Master switch. Double-click, Enter, F2, the click options, type-ahead commits and BeginEditCellAsync all check it first, and the editable-cell cue is drawn only while it is on. | | AllowAdding | bool | false | Read only by the trailing-new-row features, EnsureTrailingNewRow and AddNewRowOnLastCellExit. The toolbar Add item, AppendRow and InsertRow do not consult it. | | AllowDeleting | bool | false | Gate for the toolbar Delete item and a column's delete command, which run the confirm step and raise RowDeleting and RowDeleted. DeleteRecordAsync does not consult it. | | Mode | EditMode | EditMode.Inline | Which editor opens; the values are in the next table. | | ShowConfirmDialog | bool | true | A toolbar or command delete first shows a dialog saying how many records will go; false deletes at once. Not consulted for edits. | | NewRowPosition | NewRowPosition | NewRowPosition.Top | Where the Inline add editor sits and where the saved new row goes in the list: index 0 for Top, the end for Bottom. Batch mode does not read it. | | AllowEditOnDblClick | bool | true | In Batch mode a double-click on an editable cell opens its editor; in Inline and Dialog mode a double-click on the row opens the row editor. False leaves the double-click to OnRecordDoubleClick. | | EditOnEnterKey | bool | true | Enter on the active editable cell opens its editor with the value selected. A cell with edit options opens its list instead and does not read this. | | EditOnActiveCellClick | bool | false | A plain click on the cell that was already active opens its editor: the first click selects, the second edits. | ### Modes | Name | Description | |---|---| | Inline | A row editor takes the row's place, or sits at NewRowPosition for an add, with a generated control per editable column or the column's EditTemplate. Enter saves, Escape cancels, and OnBeginEdit and the Row events fire around it. | | Dialog | The same row editor inside a DialogControl titled Edit Record or Add New Record; closing the dialog cancels. | | Batch | No row editor. One cell at a time opens in place; Enter, Tab or a click elsewhere commits it to the bound object and Escape abandons it. OnCellEdit and OnCellSave report it; OnBeginEdit and the Row events belong to the row editor. | ### Behaviors | Name | Description | |---|---| | MultiRow | The default. When the edited row is one of several selected rows and the user typed in the editor, the commit writes the value to every selected row the predicate allows and raises OnCellSave once per row; OnCellEdit fired only for the cell that opened. Typing with several rows selected and no editor open starts a type-ahead that commits the same way. | | SingleCell | A click selects a cell, a double-click edits it, and typed keys go to that one cell and commit on Enter. Several cells of one column can be edited together only through AllowSingleCellColumnMassEdit. | ### Column | Name | Type | Default | Description | |---|---|---|---| | AllowEditing | bool | true | False keeps the cell read-only: batch and keyboard entry skip it, the Inline editor shows its plain value and the Dialog editor leaves it out. The example sets it on every column. | | IsPrimaryKey | bool | false | Never editable, whatever AllowEditing says: batch entry, BeginEditCellAsync and type-ahead skip it, the Inline editor shows its plain value and the Dialog editor shows it disabled. | | SelectAllOnEdit | bool | false | Read when the editor opens without a pointer position, for example from BeginEditCellAsync: the existing value is pre-selected so the first keystroke replaces it. Enter and F2 pre-select regardless; a click or double-click puts the caret under the pointer. | | MaxLength | int? | null | Limit of the text editor. The browser clips a longer paste and CellValueTruncated reports it. | | ShowNumericSpinner | bool | false | Number columns edit in a plain text editor with a decimal input mode; true renders a native number input with spinner arrows. | | EditTemplate | RenderFragment? | null | Replaces the generated control in the Inline and Dialog row editors; context is the row being edited, a copy until it is saved. The batch cell editor does not use it, and keyboard entry skips a column that has one. | | PreferCellEditOnDoubleClick | bool | false | Declared, but GridControl never reads it. | | ValidationRules | string? | null | Declared, but GridControl never reads it. Batch validation comes from the grid's ValidationSettings: data annotations and a custom validator. | | DefaultValue | string? | null | Declared, but GridControl never reads it. A new row's values come from NewItemFactory. | ### Column editors | Name | Type | Default | Description | |---|---|---|---| | EditOptions | IEnumerable? | null | Fixed choices for an in-cell dropdown editor in Batch mode. An entry written #value;text shows the text and stores the value; a plain entry is both. | | EditOptionsProvider | Func>? | null | Row-aware choices, called with the row and used instead of EditOptions when it returns a list; an exception from it falls back to EditOptions. | | AllowCustomEditOptionValue | bool | false | Renders the dropdown as an editable combo that also accepts a typed value outside the list. | | OpenEditOptionsOnEdit | bool | true | Opens the list as soon as a click or double-click starts the edit; false leaves that to the arrow button. | | RequireEditValueInList | bool | false | A typed value must match an allowed entry, case-insensitively and on either side of a mapped option, before the cell commits; the stored value is the mapped value. A miss shows the not-found message and keeps the editor open; an empty entry always passes. The list is EditValueListProvider, else EditValueList, else the edit options. | | EditValueList | IEnumerable? | null | Allowed values for RequireEditValueInList on a cell with a picker button rather than a dropdown. | | EditValueListProvider | Func>? | null | Row-aware allowed values; an exception from it counts as no list. | | EditValueNotFoundMessage | string? | null | Text of the refusal; a {0} placeholder takes the refused entry. Null gives the column name, the entry and not found. | | ShowEditButton | bool | false | Adds a trailing picker button to the cell while its editor is open. A click on it closes the editor and raises OnEditButtonClick; Enter on the active cell does the same when a handler is attached. | | EditButtonText | string | "..." | Caption of that button. | | AlwaysShowEditButton | bool | false | Paints the button in the display cell as well, not only while editing. | | OpenEditButtonOnDoubleClick | bool | true | A double-click on a ShowEditButton cell raises OnEditButtonClick as the button would. | | ShowEditButtonPredicate | Func? | null | Per-row veto for AlwaysShowEditButton; false hides the button on that row. | | OpenDateCalendarOnDoubleClick | bool | false | Date columns edit as text; true adds the calendar button to the editor and opens the picker on a double-click. | ### Events | Name | Type | Description | |---|---|---| | OnCellEdit | CellEditArgs | Before a batch cell opens, and before a checkbox toggle or a context-menu paste or clear writes a cell. Set Cancel to refuse. Not raised for the further rows of a multi-row commit, nor for a cell the predicate refused. | | OnCellSave | CellSaveArgs | After a value is written to the bound object: when a batch editor commits with a changed value or one the user typed, once per row the commit fanned out to, and after a checkbox toggle, a paste or clear or a type-ahead commit. The example counts these. | | OnEditButtonClick | CellEditButtonArgs | The picker button of a ShowEditButton cell was clicked, the cell was double-clicked with OpenEditButtonOnDoubleClick, or Enter was pressed on it; an open editor on that cell is closed first. | | CellValueTruncated | CellValueTruncatedArgs | A paste into a text editor with MaxLength was longer than the limit. The browser already clipped it; this reports the pasted and kept lengths. | | OnTypeAheadCommit | TypeAheadCommitArgs | A value typed with several rows selected and no editor open is being committed. With a handler the grid passes the editable selected rows and the text and writes nothing itself; without one it runs the normal validation and OnCellSave pipeline per row. | | OnBeginEdit | RowEditEventArgs | Before the Inline or Dialog row editor opens on an existing row: row double-click, F2 with one row selected, the toolbar Edit item or a column's edit command. Set Cancel to keep it closed. Not raised for an add. | | RowUpdating / RowUpdated | RowEditEventArgs | Around saving the row editor over an existing row: RowUpdating with the edited copy before it is written back to the list item (set Cancel to keep the editor open), RowUpdated after. | | RowCreating / RowCreated | RowEditEventArgs | Around saving an added row: RowCreating before it is inserted into the list at NewRowPosition (cancellable), RowCreated after. | | RowDeleting / RowDeleted | RowEditEventArgs | Per record of a toolbar or command delete, after the confirm step: RowDeleting before the removal (set Cancel to keep that record), RowDeleted after. DeleteRecordAsync raises neither. | | CellSaved | CellSavedArgs | Declared, but GridControl never raises it; OnCellSave is the event that fires after a cell commits. | | OnActionComplete | ActionEventArgs | Declared, but GridControl never raises it. | ### Edit args | Name | Type | Default | Description | |---|---|---|---| | Data | TValue | | The row about to be edited. | | ColumnName | string | "" | The column's Field. | | Cancel | bool | false | Set true to keep the cell read-only this time. | ### Save args | Name | Type | Default | Description | |---|---|---|---| | Data | TValue | | The row that was written; in a multi-row commit, each selected row in turn. | | ColumnName | string | "" | The column's Field. | | Value | object? | null | What was written: the editor text for a commit or type-ahead, a bool for a checkbox toggle. | ### Row args | Name | Type | Default | Description | |---|---|---|---| | Data | TValue? | null | The row: the list item for OnBeginEdit and the delete events, the edited copy for the update and create events. | | RowIndex | int | 0 | The row's index in the current display order; 0 for the create events. | | Cancel | bool | false | Read by OnBeginEdit, RowUpdating, RowCreating and RowDeleting; the completed events ignore it. | ### Methods | Name | Type | Description | |---|---|---| | BeginEditCellAsync(TValue row, string field) | Task | Pages to the row if needed, selects the cell and opens its batch editor as a click would, raising OnCellEdit. Needs Batch mode and an editable, non-key column; otherwise a no-op. | | EndEditAsync() | Task | Commits whatever is open: a pending type-ahead, the batch cell editor (validation and OnCellSave included), then a row editor. A validation failure keeps the editor open. | | AppendRow(TValue record, string? editField = null, bool beginEdit = true) | Task | Adds the row at the end of the list, which must be an IList or it throws, and by default opens the editor on editField or the first editable cell. The overload without record builds one with NewItemFactory; AppendRowAsync is the same method. | | InsertRow(int rowIndex, TValue record, string? editField = null, bool beginEdit = true) | Task | The same at rowIndex, clamped to the list; the overload without record and InsertRowAsync as above. | | AddRecordAsync(TValue record) | Task | Adds to the list and repaints; nothing happens when DataSource is not an IList. No editor, no events. | | DeleteRecordAsync(TValue record) | Task | Removes the row from the list and the selection and repaints. No confirm dialog, no RowDeleting or RowDeleted, and AllowDeleting is not consulted. | ## Examples ### Edit ```razor @using Fx.ControlKit.Grid

@_saveCount @(_saveCount == 1 ? "cell" : "cells") saved@(_last is null ? "" : $"; last: {_last}")

``` ```csharp private List _lines = []; private int _saveCount; private string? _last; private readonly EditSettings _editSettings = new() { AllowEditing = true, Mode = EditMode.Batch }; private readonly GridControlEvents _events = new(); protected override void OnInitialized() { _lines = BenchData.RateCard.ToList(); _events.OnCellSave = EventCallback.Factory.Create>(this, args => { _saveCount++; _last = $"{args.ColumnName} = {args.Value} on {args.Data.Code}"; }); } // Data/BenchModels.cs public sealed class RateCardItem { public string Code { get; set; } = string.Empty; public string Region { get; set; } = string.Empty; public string Destination { get; set; } = string.Empty; public string Category { get; set; } = string.Empty; public string Supplier { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string Unit { get; set; } = string.Empty; public decimal Rate { get; set; } public int MarginPercent { get; set; } public string Season { get; set; } = string.Empty; public bool Bookable { get; set; } = true; public string Notes { get; set; } = string.Empty; } ``` --- # Frozen Columns and Header Bands in a Blazor Grid URL: https://flexcoreui.com/demo/grid/advanced Section: Data Grid Controls: GridControl, GridColumn Keywords: frozen columns, pinned columns, sticky columns, fixed columns, header bands, column groups Keep key columns in view: pin them to either edge of a Blazor grid with IsFrozen, and group headers under a second row of column bands. ## Documentation ### Column | Name | Type | Default | Description | |---|---|---|---| | IsFrozen | bool | false | Pins the column while the others scroll. The cell is position: sticky, offset by the summed widths of the frozen columns before it on the same edge (a column without a declared width counts as 120px). A lock set from the header menu overrides the declared value at runtime. | | FrozenPosition | FrozenColumnPosition | FrozenColumnPosition.Left | The edge a frozen column sticks to, Left or Right. Ignored while IsFrozen is off. | | HeaderBand | string? | null | Name of the band above this column; adjacent visible columns with the same name share one spanning cell. A ColumnHeaderBands entry that lists the field wins over this. | | AllowEditing | bool | true | Whether this column's cells open an editor when the grid's EditSettings allow editing. Auto-generated columns set it from the property. | ### Grid | Name | Type | Default | Description | |---|---|---|---| | ColumnHeaderBands | IReadOnlyList? | null | Band descriptors for the extra header row. Fields match case-insensitively; a band whose columns are separated by reordering or by a frozen edge renders one cell per contiguous run; columns in no band get an empty cell. | | EditSettingsRef | EditSettings? | null | The grid's editing settings, a plain object rather than a component. This page sets AllowEditing and Mode = EditMode.Batch. | ### Band | Name | Type | Default | Description | |---|---|---|---| | HeaderText | string | string.Empty | Caption of the spanning cell, also shown as its tooltip. | | Fields | IReadOnlyList | Array.Empty() | Fields of the columns the band owns, matched case-insensitively. | | HeaderTemplate | RenderFragment? | null | Custom content for the band cell instead of the caption. | | CssClass | string? | null | Appended to the band cell's class. | | TextAlign | TextAlign | TextAlign.Center | Alignment of the caption. | ### Edit | Name | Type | Default | Description | |---|---|---|---| | AllowEditing | bool | false | Master switch. Off, no cell opens an editor whatever the columns say. | | Mode | EditMode | EditMode.Inline | Inline edits a whole row, Dialog opens a form, Batch edits cell by cell as on this page: double-click or Enter opens the editor, Tab commits and moves on, Escape abandons. | ## Examples ### Frozen ```razor @using Fx.ControlKit @using Fx.ControlKit.Grid

@_rows.Count rows

``` ```csharp public class GridItem { public int Id { get; set; } public string Code { get; set; } = ""; public string Name { get; set; } = ""; public string Category { get; set; } = ""; public int Quantity { get; set; } public decimal UnitPrice { get; set; } public decimal Discount { get; set; } public string Status { get; set; } = "Active"; public string Action { get; set; } = ""; } private List _rows = new(); private readonly EditSettings _editSettings = new() { AllowEditing = true, Mode = EditMode.Batch }; private readonly IReadOnlyList _headerBands = [ new("Identity", nameof(GridItem.Id), nameof(GridItem.Code)), new("Product", nameof(GridItem.Name), nameof(GridItem.Category)), new("Workflow", nameof(GridItem.Status), nameof(GridItem.Action)) ]; private void Remove(GridItem row) => _rows = _rows.Where(r => r != row).ToList(); protected override void OnInitialized() { var list = new List(); var cats = new[] { "Hotel", "Flight", "Tour", "Transfer", "Cruise", "Rail" }; var places = new[] { "Lisbon", "Kyoto", "Cape Town", "Reykjavik", "Queenstown" }; for (int i = 1; i <= 200; i++) { list.Add(new GridItem { Id = i, Code = $"SVC-{i:D5}", Name = $"{places[i % places.Length]} {cats[i % cats.Length].ToLowerInvariant()} #{i}", Category = cats[i % cats.Length], Quantity = 10 + (i * 7) % 150, UnitPrice = 15.50m + (i % 25) * 4.25m, Discount = (i % 5) * 2.5m, Status = (i % 6 == 0) ? "Pending" : "Active" }); } _rows = list; } ``` --- # Blazor Grid Export to Excel and CSV URL: https://flexcoreui.com/demo/grid/enterprise-suite Section: Data Grid Controls: GridControl, GridColumn Keywords: Excel export, xlsx export, CSV export, export to Excel, column template Give users their data in Excel: export a Blazor grid's filtered, sorted rows to a real .xlsx workbook or CSV, and render any column from your own template. ## Documentation ### Export | Name | Type | Description | |---|---|---| | ExportToCsvAsync(string? fileName = null) | Task | Comma-separated text: a header line, then the display values row by row; a value holding the delimiter, a quote or a line break is quoted, an empty value is written as two quotes. Encoded per DelimitedExportEncoding. ExportAsync with GridExportFormat.Csv; the CSV button on this page calls it. | | ExportToTsvAsync(string? fileName = null) | Task | The same with a tab delimiter. | | ExportToXlsxAsync(string? fileName = null) | Task | A real workbook from Fx.ControlKit.Excel.XlsxWriter in the FlexCore assembly: bold shaded header, thin borders, number formats resolved from each column's Format, column widths from the grid, native numbers and dates instead of display text, and a column Formula that references only exported fields written as a cell formula. The Excel button on this page calls it. | | ExportToExcelAsync(string? fileName = null) | Task | Compatibility alias: it calls ExportToXlsAsync, so the file is an HTML table with an .xls name, not a workbook. | | ExportToXlsAsync(string? fileName = null) | Task | The HTML table of ExportToHtmlAsync without the document wrapper, served as application/vnd.ms-excel with an .xls extension. | | ExportToHtmlAsync(string? fileName = null) | Task | A standalone HTML document with one styled table; row and cell styles become a bold class and inline CSS. | | ExportToJsonAsync(string? fileName = null) | Task | An indented JSON array, one object per row keyed by header text (ColumnN for a blank header), holding the display values. | | ExportToPdfAsync(string title = "Export") | Task | PDF with a default GridPdfPrintOptions, named after the title. The toolbar pdf item calls this overload. Whatever title is passed, the grid's Title, Data or Id parameter replaces it when one is set (ResolveExportTitle, shared by every method here). | | ExportToPdfAsync(string fileName, string title) | Task | The same with an explicit file name. | | ExportToPdfAsync(string fileName, string title, GridPdfPrintOptions? pdfOptions, bool showCompletionStatus = true) | Task | Page size, orientation, column layout, margin and zoom from pdfOptions; false suppresses the status pill. The header-menu Print command calls this with the dialog's choices, the name grid-export.pdf and no pill. | | ExportToPdfFileAsync(string fileName = "export.pdf", string title = "Export") | Task | The two-argument PDF overload with defaults for both. | | ExportAsync(GridExportFormat format, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null, bool showCompletionStatus = true) | Task | What the methods above call. Builds the table (the pivot table in pivot mode; every provider page when ExportAllProviderItems is on; otherwise SortedData and VisibleColumns), runs GridExporter.ExportWithEncoding with DelimitedExportEncoding, then GridExporter.SaveAsync. A null or blank file name becomes the sanitized title; a missing extension is added. Afterward the pill shows N rows exported successfully. for about 2.5 seconds, or a warning when the save dialog could not open; a canceled dialog shows nothing. | | CreateExport(GridExportFormat format, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null) | GridExportResult | The same bytes without the browser step: a GridExportResult record with Bytes, FileName and ContentType, for your own storage or mail. Synchronous, so a provider grid exports only the rows it has loaded. | | ExportWithEncodingAsync(GridExportFormat format, GridDelimitedTextEncoding delimitedEncoding, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null, bool showCompletionStatus = true) | Task | ExportAsync with a one-off CSV/TSV encoding in place of DelimitedExportEncoding; the other formats ignore it. | | CreateExportWithEncoding(GridExportFormat format, GridDelimitedTextEncoding delimitedEncoding, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null) | GridExportResult | CreateExport with a one-off encoding. | | ExportToCsvWithEncodingAsync(GridDelimitedTextEncoding delimitedEncoding, string? fileName = null) | Task | CSV with an explicit encoding. | | ExportToTsvWithEncodingAsync(GridDelimitedTextEncoding delimitedEncoding, string? fileName = null) | Task | TSV with an explicit encoding. | ### Provider | Name | Type | Description | |---|---|---| | ExportProviderQueryAsync(GridExportFormat format, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null, bool showCompletionStatus = true, CancellationToken cancellationToken = default) | Task | With an ItemsProvider: pages through the whole current query (sort, filters, search) in ProviderExportPageSize batches, raising ProviderExportProgressChanged from before the first page, then saves like ExportAsync. Does not need ExportAllProviderItems; starting it cancels an export already in flight. Without a provider it is ExportAsync. | | CreateProviderExportAsync(GridExportFormat format, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null, CancellationToken cancellationToken = default) | Task | The bytes of that complete query without the browser step; CreateExport when there is no provider. | | ExportProviderQueryWithEncodingAsync(GridExportFormat format, GridDelimitedTextEncoding delimitedEncoding, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null, bool showCompletionStatus = true, CancellationToken cancellationToken = default) | Task | ExportProviderQueryAsync with a one-off CSV/TSV encoding. | | CreateProviderExportWithEncodingAsync(GridExportFormat format, GridDelimitedTextEncoding delimitedEncoding, string? fileName = null, string title = "Export", GridPdfPrintOptions? pdfOptions = null, CancellationToken cancellationToken = default) | Task | CreateProviderExportAsync with a one-off encoding. | | CancelProviderExport() | void | Cancels the provider export in flight, if any. | ### Exporter | Name | Type | Description | |---|---|---| | Export(GridExportTable table, GridExportFormat format, string? fileName = null, GridPdfPrintOptions? pdfOptions = null) | GridExportResult | Bytes for a GridExportTable you assembled yourself; CSV and TSV as UTF-8 without a byte-order mark. | | ExportWithEncoding(GridExportTable table, GridExportFormat format, GridDelimitedTextEncoding delimitedEncoding, string? fileName = null, GridPdfPrintOptions? pdfOptions = null) | GridExportResult | The dispatcher behind every grid export: one builder per GridExportFormat; the file name is the argument or the sanitized table Title, given the format's extension when it has none. | | SaveAsync(IJSRuntime jsRuntime, GridExportResult export) | Task | Imports the library's grid-control.js module and calls its saveFile with the file name, the bytes as base-64 and the content type, returning the module's result string; unavailable when the module could not be imported. The grid treats cancelled as no message and unavailable as a warning. This is the step the grid methods use. | | DownloadAsync(IJSRuntime jsRuntime, GridExportResult export) | Task | Same module, downloadFile: a plain download without a dialog. TreeGridControl.DownloadAsync uses it; GridControl does not. | | DefaultExtension(GridExportFormat format) | string | The extension for a format, as listed in the values table. | ### Formats | Name | Description | |---|---| | Csv | BuildDelimited with a comma: header line, then the display values row by row; a value holding the delimiter, a quote or a line break is quoted, an empty value is written as two quotes. text/csv, .csv; a charset suffix is added for the BOM and ASCII encodings. | | Tsv | The same with a tab. text/tab-separated-values, .tsv. | | Html | A standalone HTML document with one styled table: bold rows get a bold class, highlight columns a highlight class; cell colors, alignment, italics and strikethrough become inline CSS. text/html, .html. | | Xls | That table without the document wrapper, served as application/vnd.ms-excel with .xls so Excel opens it. HTML, not a workbook. | | Xlsx | An OOXML workbook from XlsxWriter: the only format that uses XlsxValues, XlsxFormats and column Formula translation. application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, .xlsx. An unknown format value falls back to this. | | Pdf | The library's own writer, NativePdfDocument.WriteLegacy: one content stream per page over the standard Helvetica and Helvetica-Bold fonts (bold for the header and for bold rows), gray header fill, optional grid lines, text widths from a built-in estimate, and extra page sets when the columns do not fit the width. application/pdf, .pdf. | | Json | An indented array of objects keyed by header text. application/json, .json. | ### Params | Name | Type | Default | Description | |---|---|---|---| | RowExportStyleSelector | Func? | null | Called once per exported row with the item and its row index. A non-null result copies ForeColorHex and BackColorHex to the row and sets the row's bold, italic and strikethrough flags where the matching property is non-null. Honored by Xlsx, Html and Xls; the PDF uses the bold flag only; CSV, TSV and JSON carry no styling. Not called for the appended total rows. | | CellExportStyleSelector | Func? | null | Called per row and visible column with the item, the column Field and the row index. In Xlsx, Html and Xls each non-null property overrides the row's value for that cell, so a cell with Bold = false inside a bold row exports in normal weight. Not read by the PDF, CSV, TSV or JSON builders. | | DelimitedExportEncoding | GridDelimitedTextEncoding | GridDelimitedTextEncoding.Utf8NoBom | Byte encoding of CSV and TSV: Utf8NoBom, Utf8WithBom, Utf16LittleEndian or Ascii (characters outside ASCII become a question mark). The other formats ignore it. | | IncludeTotalsInExport | bool | true | Appends the footer AggregateRows (those with ShowInFooter) as bold rows after the data, formatted as on screen; in Xlsx they keep native values and formats and skip column formulas. Nothing is added when this is false, there are no footer rows, or there is no data. | | ShowPrintOptionsDialog | bool | true | The header-menu Print command opens the print-options dialog first; false makes it export the PDF at once with the defaults below. | | DefaultPrintOrientation | GridPdfOrientation | GridPdfOrientation.Portrait | Starting value of that dialog, and the value Print uses without it. The six DefaultPrint… parameters are read only on that menu path: ExportToPdfAsync takes its layout from the GridPdfPrintOptions you pass. | | DefaultPrintPageSize | GridPdfPageSize | GridPdfPageSize.Letter | Letter, Legal or A4; same path. | | DefaultPrintColumnLayout | GridPdfColumnLayout | GridPdfColumnLayout.WrapText | WrapText, ClipText or FitColumnsToPage; same path. Ignored while the zoom mode is FitToPage, which always fits the columns. | | DefaultPrintGridLines | bool | true | Cell borders in the printed PDF; same path. | | DefaultPrintZoomMode | GridPdfZoomMode | GridPdfZoomMode.FitToPage | FitToPage scales the table down until its natural width fits the page; Percent uses the percentage below. Same path. | | DefaultPrintZoomPercent | int | 100 | Clamped to 25 to 200; same path. | | ExportAllProviderItems | bool | false | With an ItemsProvider, makes ExportAsync and every ExportTo…Async page through the whole query like ExportProviderQueryAsync. Off, they export the rows the provider has loaded. | | ProviderExportPageSize | int | 1_000 | Rows requested per provider call while paging an export; clamped to 1 to 100000. | | ProviderExportProgressChanged | EventCallback | default | Raised from before the first page as a provider export progresses, with ExportedRows, TotalRows, IsCompleted and IsCanceled; the latest record is also kept in ProviderExportProgress. | ### Cell style | Name | Type | Default | Description | |---|---|---|---| | ForeColorHex | string? | null | Text color as three- or six-digit hex, with or without a leading #. Black is dropped (it is the default color) and anything unparseable is ignored. | | BackColorHex | string? | null | Fill color in the same forms; white is dropped. When null, a highlighted column fills ffffc1 in Xlsx and takes the highlight class in HTML. | | Bold | bool? | null | Null inherits the row flag; true or false overrides it for this cell. From the row selector, null leaves the row flag alone. | | Italic | bool? | null | Same rule for italics. | | Strikethrough | bool? | null | Same rule for strikethrough. | ### Pdf options | Name | Type | Default | Description | |---|---|---|---| | Orientation | GridPdfOrientation | GridPdfOrientation.Portrait | Landscape swaps the page width and height. | | PageSize | GridPdfPageSize | GridPdfPageSize.Letter | Letter 612 by 792 points, Legal 612 by 1008, A4 595 by 842. | | ColumnLayout | GridPdfColumnLayout | GridPdfColumnLayout.WrapText | WrapText wraps cell text up to MaxWrappedLines; ClipText keeps one line; FitColumnsToPage scales the column widths to the content width. Forced to FitColumnsToPage while ZoomMode is FitToPage. | | Margin | double | 24 | Points on all four sides, clamped to 12 to 72. | | MaxWrappedLines | int | 4 | Lines per cell in WrapText, clamped to 1 to 12. | | IncludeColumnHeaders | bool | true | Repeats the header row at the top of every page (the table's IncludeHeaderRow must also be true). | | ShowGridLines | bool | true | Thin gray borders around every cell. | | ZoomMode | GridPdfZoomMode | GridPdfZoomMode.FitToPage | FitToPage scales fonts, padding and widths down (never up, floor 12 percent) until the natural column widths fit the content width; Percent uses ZoomPercent. | | ZoomPercent | int | 100 | Used with Percent; clamped to 25 to 200. | ### Templates | Name | Type | Default | Description | |---|---|---|---| | Template | RenderFragment? | null | Replaces the cell content. The grid invokes it as EffectiveTemplate((object)item), so context is the row item typed as object; cast it to your row class as the Status column does. Exports never see the markup: a templated column writes its Field value formatted like a plain cell (Format, DisplayFormatter, DisplayField), which is why the badge exports as text. | | ChildContent | RenderFragment? | null | Shorthand for Template: markup placed directly inside without a