@serenity-is/sleekgrid / GridOptions
Interface: GridOptions<TItem>
Defined in: src/core/gridoptions.ts:13
Configuration options for the SleekGrid component.
Type Parameters
TItem
TItem = any
The type of items in the grid.
Properties
addNewRowCssClass?
optionaladdNewRowCssClass:string
Defined in: src/core/gridoptions.ts:17
CSS class applied to newly added rows for custom styling. Default is "new-row".
alwaysAllowHorizontalScroll?
optionalalwaysAllowHorizontalScroll:boolean
Defined in: src/core/gridoptions.ts:22
Defaults to false. If true, a horizontal scrollbar is always visible regardless of content width.
alwaysShowVerticalScroll?
optionalalwaysShowVerticalScroll:boolean
Defined in: src/core/gridoptions.ts:27
Defaults to false. If true, a vertical scrollbar is always visible, useful for fixed-height grids or menus.
asyncEditorLoadDelay?
optionalasyncEditorLoadDelay:number
Defined in: src/core/gridoptions.ts:32
Defaults to 100. Delay in milliseconds before asynchronous loading of editors.
asyncEditorLoading?
optionalasyncEditorLoading:boolean
Defined in: src/core/gridoptions.ts:37
Defaults to false. If true, editors are loaded asynchronously, reducing initial rendering load.
asyncPostCleanupDelay?
optionalasyncPostCleanupDelay:number
Defined in: src/core/gridoptions.ts:42
Defaults to 40. Delay in milliseconds before cleaning up post-rendered elements.
asyncPostRenderDelay?
optionalasyncPostRenderDelay:number
Defined in: src/core/gridoptions.ts:47
Defaults to -1 which means immediate execution. Delay in milliseconds before starting asynchronous post-rendering.
autoEdit?
optionalautoEdit:boolean
Defined in: src/core/gridoptions.ts:52
Defaults to true. If true, automatically opens the cell editor when a cell gains focus.
autoHeight?
optionalautoHeight:boolean
Defined in: src/core/gridoptions.ts:57
Defaults to false. If true, automatically adjusts the grid's height to fit the entire content without scrolling.
cellFlashingCssClass?
optionalcellFlashingCssClass:string
Defined in: src/core/gridoptions.ts:62
CSS class applied to cells with a flashing effect. Default is "flashing".
columns?
optionalcolumns:Column<TItem>[]
Defined in: src/core/gridoptions.ts:72
Array of column definitions for the grid.
createPreHeaderPanel?
optionalcreatePreHeaderPanel:boolean
Defined in: src/core/gridoptions.ts:77
Deprecated
Use showGroupingPanel option instead.
dataItemColumnValueExtractor()?
optionaldataItemColumnValueExtractor: (item,column) =>void
Defined in: src/core/gridoptions.ts:82
Function to extract column values from data items, used for custom copy buffer operations. Default is null.
Parameters
item
TItem
column
Column<TItem>
Returns
void
defaultColumnWidth?
optionaldefaultColumnWidth:number
Defined in: src/core/gridoptions.ts:87
Defaults to 80. Default width of columns in pixels.
defaultFormat?
optionaldefaultFormat:ColumnFormat<TItem>
Defined in: src/core/gridoptions.ts:92
Default formatting options for columns. Default is defaultColumnFormat.
defaultFormatter?
optionaldefaultFormatter:CompatFormatter<TItem>
Defined in: src/core/gridoptions.ts:97
Default formatter function for cells.
editable?
optionaleditable:boolean
Defined in: src/core/gridoptions.ts:102
Defaults to false. If true, cells can be edited inline.
editCommandHandler()?
optionaleditCommandHandler: (item,column,command) =>void
Defined in: src/core/gridoptions.ts:107
Function to handle edit commands, useful for implementing custom undo support. Default is null.
Parameters
item
TItem
column
Column<TItem>
command
Returns
void
editorCellNavOnLRKeys?
optionaleditorCellNavOnLRKeys:boolean
Defined in: src/core/gridoptions.ts:112
Defaults to false. If true, enables navigation between cells using left and right arrow keys within the editor.
editorFactory?
optionaleditorFactory:EditorFactory
Defined in: src/core/gridoptions.ts:117
Factory function for creating custom editors. Default is null.
editorLock?
optionaleditorLock:EditorLock
Defined in: src/core/gridoptions.ts:122
Global editor lock instance, used for managing concurrent editor access. Default is GlobalEditorLock.
emptyNode()?
optionalemptyNode: (node) =>void
Defined in: src/core/gridoptions.ts:67
Function to handle clearing a DOM node, used for custom cleanup logic. Default is null.
Parameters
node
Element
Returns
void
enableAddRow?
optionalenableAddRow:boolean
Defined in: src/core/gridoptions.ts:127
Defaults to false. If true, enables the ability to add new rows to the grid.
enableAsyncPostRender?
optionalenableAsyncPostRender:boolean
Defined in: src/core/gridoptions.ts:132
Defaults to false. If true, enables asynchronous post-rendering.
enableAsyncPostRenderCleanup?
optionalenableAsyncPostRenderCleanup:boolean
Defined in: src/core/gridoptions.ts:137
Defaults to false. If true, enables cleanup after asynchronous post-rendering.
enableCellNavigation?
optionalenableCellNavigation:boolean
Defined in: src/core/gridoptions.ts:142
Defaults to true. If true, enables cell navigation with arrow keys.
enableCellRangeSelection?
optionalenableCellRangeSelection:boolean
Defined in: src/core/gridoptions.ts:147
Defaults to false. If true, allows selection of cell ranges.
enableColumnReorder?
optionalenableColumnReorder:boolean
Defined in: src/core/gridoptions.ts:152
Defaults to true. If true, enables column reordering.
enableHtmlRendering?
optionalenableHtmlRendering:boolean
Defined in: src/core/gridoptions.ts:158
Allow returning raw HTML strings from formatters and use innerHTML to render them. Defaults to false for tighter security.
It is recommended to leave this as false for better security and to avoid XSS vulnerabilities. In that case, formatters should return plain text or DOM elements.
enableRowReordering?
optionalenableRowReordering:boolean
Defined in: src/core/gridoptions.ts:163
Defaults to false. If true, enables row reordering.
enableTabKeyNavigation?
optionalenableTabKeyNavigation:boolean
Defined in: src/core/gridoptions.ts:168
Defaults to true. If true, enables navigation between cells using the Tab key.
enableTextSelectionOnCells?
optionalenableTextSelectionOnCells:boolean
Defined in: src/core/gridoptions.ts:173
Defaults to false. If true, enables text selection within cells.
explicitInitialization?
optionalexplicitInitialization:boolean
Defined in: src/core/gridoptions.ts:178
Defaults to false. If true, requires explicit initialization of the grid.
footerRowHeight?
optionalfooterRowHeight:number
Defined in: src/core/gridoptions.ts:183
Defaults to null which means the footer row height is calculated based on CSS rules.
forceFitColumns?
optionalforceFitColumns:boolean
Defined in: src/core/gridoptions.ts:188
Defaults to false. If true, forces columns to fit the grid width.
forceSyncScrolling?
optionalforceSyncScrolling:boolean
Defined in: src/core/gridoptions.ts:193
Defaults to false. If true, synchronizes scrolling between the grid and its container.
forceSyncScrollInterval?
optionalforceSyncScrollInterval:number
Defined in: src/core/gridoptions.ts:198
Defaults to 250. Interval in milliseconds for synchronizing scrolling when forceSyncScrolling is enabled.
formatterFactory?
optionalformatterFactory:FormatterFactory
Defined in: src/core/gridoptions.ts:203
Factory function for creating custom formatters. Default is null.
frozenBottom?
optionalfrozenBottom:number|boolean
Defined in: src/core/gridoptions.ts:208
Defaults to false. If true, places frozen rows at the bottom edge of the grid.
frozenColumns?
optionalfrozenColumns:number
Defined in: src/core/gridoptions.ts:214
Defaults to undefined. If specified, freezes the given number of columns on the left edge of the grid.
Prefer setting column.frozen = 'true' for individual columns as this is only for compatibility.
frozenRows?
optionalfrozenRows:number
Defined in: src/core/gridoptions.ts:220
Defaults to undefined. If specified, freezes the given number of rows at the top or bottom
edge (if frozenBottom === true).
fullWidthRows?
optionalfullWidthRows:boolean
Defined in: src/core/gridoptions.ts:225
Defaults to false. If true, makes rows take the full width of the grid.
groupingPanel?
optionalgroupingPanel:boolean
Defined in: src/core/gridoptions.ts:230
Defaults to false. If true, shows the grouping panel for grouping columns.
groupingPanelHeight?
optionalgroupingPanelHeight:number
Defined in: src/core/gridoptions.ts:235
Defaults to null, e.g. calculated based on CSS. Height of the grouping panel in pixels.
groupTotalsFormat()?
optionalgroupTotalsFormat: (ctx) =>FormatterResult
Defined in: src/core/gridoptions.ts:240
Function to format group totals for display in the grouping panel.
Parameters
ctx
FormatterContext<IGroupTotals<TItem>>
Returns
groupTotalsFormatter()?
optionalgroupTotalsFormatter: (totals?,column?,grid?) =>string
Defined in: src/core/gridoptions.ts:246
Function to format group totals for display in the grouping panel.
Parameters
totals?
IGroupTotals<TItem>
column?
Column<TItem>
grid?
Returns
string
Deprecated
Use groupTotalsFormat with FormatterContext<IGroupTotals> signature instead.
headerRowHeight?
optionalheaderRowHeight:number
Defined in: src/core/gridoptions.ts:251
Defaults to null, e.g. calculated based on CSS. Height of the header row in pixels.
jQuery?
optionaljQuery:object
Defined in: src/core/gridoptions.ts:256
jQuery object for compatibility or custom integration purposes. Default is undefined unless jQuery is available in the global object (e.g. window).
fn
fn:
any
ready
ready:
any
layoutEngine?
optionallayoutEngine:LayoutEngine| () =>LayoutEngine
Defined in: src/core/gridoptions.ts:266
Layout engine for custom grid layouts. Default is BasicLayout. Use FrozenLayout to enable frozen columns / rows.
leaveSpaceForNewRows?
optionalleaveSpaceForNewRows:boolean
Defined in: src/core/gridoptions.ts:261
Defaults to false. If true, leaves space for new rows in the DOM visible buffer.
minBuffer?
optionalminBuffer:number
Defined in: src/core/gridoptions.ts:271
Defaults to 3. Minimum number of rows to keep in the buffer.
multiColumnSort?
optionalmultiColumnSort:boolean
Defined in: src/core/gridoptions.ts:276
Defaults to false. If true, allows sorting by multiple columns simultaneously.
multiSelect?
optionalmultiSelect:boolean
Defined in: src/core/gridoptions.ts:281
Defaults to true. If true, enables multiple cell selection.
preHeaderPanelHeight?
optionalpreHeaderPanelHeight:number
Defined in: src/core/gridoptions.ts:286
Deprecated
Use groupingPanelHeight option instead.
removeNode()?
optionalremoveNode: (node) =>void
Defined in: src/core/gridoptions.ts:304
Function to handle removing a DOM node, used for custom cleanup logic. Default is null or jQuery.remove if available.
Parameters
node
Element
Returns
void
renderAllCells?
optionalrenderAllCells:boolean
Defined in: src/core/gridoptions.ts:291
Defaults to false. If true, renders all cells (row columns) in the viewport, at the cost of higher memory usage and reduced performance.
renderAllRows?
optionalrenderAllRows:boolean
Defined in: src/core/gridoptions.ts:299
Defaults to false. If true, renders all rows in the viewport, at the cost of higher memory usage and reduced performance.
When both renderAllCells and renderAllRows are true, all cells in the grid are rendered (e.g. virtualization is disabled),
which can be very slow for large datasets, but may be desired to keep all rows and cells in the DOM for accessibility purposes,
proper tabbing and screen reader support.
rowHeight?
optionalrowHeight:number
Defined in: src/core/gridoptions.ts:309
Defaults to 30. Height of rows in pixels.
rtl?
optionalrtl:boolean
Defined in: src/core/gridoptions.ts:314
Default is based on document element's (<html/>) dir property.. If true, enables right-to-left text direction.
sanitizer()?
optionalsanitizer: (dirtyHtml) =>string
Defined in: src/core/gridoptions.ts:320
Optional function for sanitizing HTML strings to avoid XSS attacks.
Default is DOMPurify.sanitize if available globally, otherwise falls back to basicDOMSanitizer.
Parameters
dirtyHtml
string
Returns
string
selectedCellCssClass?
optionalselectedCellCssClass:string
Defined in: src/core/gridoptions.ts:325
CSS class applied to selected cells. Default is "selected".
showCellSelection?
optionalshowCellSelection:boolean
Defined in: src/core/gridoptions.ts:330
Defaults to true. If true, shows cell selection indicators.
showColumnHeader?
optionalshowColumnHeader:boolean
Defined in: src/core/gridoptions.ts:335
Defaults to true. If true, displays the column header.
showFooterRow?
optionalshowFooterRow:boolean
Defined in: src/core/gridoptions.ts:340
Defaults to false. If true, displays the footer row.
showGroupingPanel?
optionalshowGroupingPanel:boolean
Defined in: src/core/gridoptions.ts:345
Defaults to false. If true, displays the grouping panel.
showHeaderRow?
optionalshowHeaderRow:boolean
Defined in: src/core/gridoptions.ts:350
Defaults to false. If true, displays the header row.
showPreHeaderPanel?
optionalshowPreHeaderPanel:boolean
Defined in: src/core/gridoptions.ts:355
Deprecated
Use showGroupingPanel option instead.
showTopPanel?
optionalshowTopPanel:boolean
Defined in: src/core/gridoptions.ts:360
Defaults to false. If true, displays the post-header panel for additional controls or information.
suppressActiveCellChangeOnEdit?
optionalsuppressActiveCellChangeOnEdit:boolean
Defined in: src/core/gridoptions.ts:365
Defaults to false. If true, suppresses the activation of cells when they contain an editor and are clicked.
syncColumnCellResize?
optionalsyncColumnCellResize:boolean
Defined in: src/core/gridoptions.ts:370
Defaults to false. If true, synchronizes column resizing with cell resizing.
topPanelHeight?
optionaltopPanelHeight:number
Defined in: src/core/gridoptions.ts:375
Defaults to null which means the top panel height is calculated based on CSS rules.
useCssVars?
optionaluseCssVars:number|boolean
Defined in: src/core/gridoptions.ts:388
Defaults to true which is equivalent to 50. If true, uses CSS variables for styling (for up to 50 cols).
If set to a number, enables CSS variables only if column count is less than or equal to that number.
This is dependent on the stylesheet which only supports up to 50 columns by default.
But if you defined your own stylesheet with more columns, you can set this to a higher number.
useLegacyUI?
optionaluseLegacyUI:boolean
Defined in: src/core/gridoptions.ts:380
Deprecated
This option has no effect.
viewportClass?
optionalviewportClass:string
Defined in: src/core/gridoptions.ts:393
CSS class applied to the viewport container. Default is undefined.