Skip to main content
Version: 1.0.4

IDataTableProps

@spartanfx/react v1.0.4


@spartanfx/react / IDataTableProps

Interface: IDataTableProps<T>

Props for the DataTable component - a generic data table without SPFx dependencies.

Supports both traditional DetailsList and responsive TileView, as well as filtering, sorting, searching, and context menus.

Type Parameters

T

T = any

The type of items in the DataTable (for type-safe fieldName)

Properties

PropertyTypeDescription
appearance?AppearanceModeAppearance mode for theming (light or dark) Default AppearanceMode.light
availableColumns?IColumn[]All available columns for column selector (if different from visible columns) Work alongside with viewKey to store the column configuration
columns(IColumn | IDataTableColumn<T>)[]Array of columns to be rendered in the view. Can be either simplified IDataTableColumn or full IColumn definitions, or a mix of both.
currentFilters?objectCurrent active filters
detailsListProps?Partial<IDetailsListProps>Optional overrides for Fluent UI's DetailsList props.
disableFiltering?booleanDisables column-based filtering entirely.
disableLoadingAnimation?booleanDisable inner loading animation
disableSorting?booleanDisables column-based sorting entirely.
enableCellContextMenu?booleanEnable cell context menu (right-click on cells)
enableColumnSelector?booleanEnable the column selector feature allowing users to customize visible columns
error?ErrorCurrent error state
exportAttributeOverride?objectOptional attribute override for export (e.g., Requestor: 'title')
exportButtonProps?objectExport button props customization
exportButtonProps.iconName?string-
exportButtonProps.text?string-
fieldInfo?IDataTableFieldType[]Optional field metadata (for field renderers and tooltips)
forceReload?() => void | Promise<void>Force reload of items and total count (useful after external CUD operations)
forceTileView?booleanForces tile view layout regardless of screen width.
gridProps?Partial<IGridProps>Optional Grid props for customizing tile layout in tile view Passed through to the Grid component used by TileList
hasMore?booleanWhether more items are available to load
headerText?stringOptional title or header text to show at the top of the list.
hideExport?booleanHides the Export to Excel button.
hideSearch?booleanHides the search box in the header.
hideSortAndFilterButton?booleanHides the sort and filter button in tile view.
highlightedFieldName?stringField to visually highlight in the tile view.
itemsT[]Array of items to display in the table
listName?stringOptional list name for Excel export sheet naming
loading?booleanCurrent loading state
loadingCount?booleanLoading state specifically for counting total items
onDismissTileViewFilterSortPanel?() => voidCallback fired when the tile view filter/sort pane is dismissed.
onExport?() => any[] | Promise<any[]>Callback when export to Excel is requested Returns all items matching current filters/search for export
onFilter?(fieldName, selectedValues) => void | Promise<void>Callback when filter is applied
onGetFilterOptions?(fieldName, currentFilters) => Promise<IFilterCriteria[]>Callback to get available filter options for a field (replacing context-based filter API)
onItemClick?(item) => voidOptional handler fired when a list item is clicked.
onLoadingStateChanged?(loading) => voidCallback triggered when the loading state changes
onLoadMore?(pageRef?) => void | Promise<void>Callback to load more items (pagination)
onRefresh?() => voidCallback for refresh button
onRenderDataTableControls?() => ElementAllows injecting custom UI controls above the list (e.g., command bar, filters).
onRenderItemCount?(itemCount) => ElementOptional onRenderItemCount. Use this to pass a custom renderer for the item count.
onRenderItemCountNumber?(itemCount) => ElementOptional onRenderItemCountNumber. Use this to pass a custom renderer to render the item count number.
onRenderSortAndFilterButton?(hasFilters, onClick) => ElementAllows customization of the Sort/Filter button in tile view.
onRenderTile?(item, columns) => anyOptional custom tile renderer for use with tile view mode.
onSearch?(searchText) => void | Promise<void>Callback when search text changes
onSelectedColumnsChange?(columns) => voidCallback when selected columns are changed (for persistence)
onSelectionChanged?(selectedItems) => anyOptional onSelectionChanged. Ignored if SelectionMode is set to none
onSort?(fieldName, descending) => void | Promise<void>Callback when sort is requested
searchBoxProps?Partial<IExtendedSearchBoxProps>Optional ExtendedSearchBox props.
searchPlaceholder?stringPlaceholder text for search box
searchText?stringCurrent search text (controlled)
selectedColumns?IColumn[]Selected columns (controlled mode). When provided, the component won't use internal localStorage. Use with onSelectedColumnsChange to manage column selection externally.
selectionMode?SelectionModeOptional selection mode. Default value 'none'
showItemCount?booleanOptional showItemCount. Show the number of total items.
themeTokens?objectOptional theme tokens to customize DataTable appearance. CSS custom properties that override default theme values.
themeTokens.borderRadius?stringBorder radius
themeTokens.colorBackground?stringBackground color for main container
themeTokens.colorBorder?stringBorder color
themeTokens.colorHover?stringHover state background
themeTokens.colorPrimary?stringPrimary accent color
themeTokens.colorSelected?stringSelected state background
themeTokens.colorText?stringPrimary text color
themeTokens.colorTextSecondary?stringSecondary text color
themeTokens.shadow?stringBox shadow
themeTokens.spacing?stringSpacing unit
themeTokens.transition?stringTransition duration
tileListProps?Partial<ITileListProps>Optional TileList props
tileViewFilterSortPanelExclusions?string[]Field names to exclude from filter/sort pane in tile view.
tileViewFilterSortPanelOpened?booleanControls whether the tile view filter/sort pane is open by default.
tileViewThreshold?numberThreshold below which the tile view is enabled automatically. Default 1185
totalItems?numberTotal number of items available (for pagination display)
translate?(text) => stringOptional translation function for labels like buttons and filters.
translatedFields?string[]Array of field internal names that require translation of their filter values.
viewKey?stringView key for column persistence (used in localStorage key) Mandatory to save column configuration to local storage