@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:48
Defaults to 100. Delay in milliseconds before asynchronous loading of editors.
asyncEditorLoading?
optionalasyncEditorLoading:boolean
Defined in: src/core/gridoptions.ts:53
Defaults to false. If true, editors are loaded asynchronously, reducing initial rendering load.
asyncPostCleanupDelay?
optionalasyncPostCleanupDelay:number
Defined in: src/core/gridoptions.ts:58
Defaults to 40. Delay in milliseconds before cleaning up post-rendered elements.
asyncPostRenderDelay?
optionalasyncPostRenderDelay:number
Defined in: src/core/gridoptions.ts:63
Defaults to -1 which means immediate execution. Delay in milliseconds before starting asynchronous post-rendering.
autoEdit?
optionalautoEdit:boolean
Defined in: src/core/gridoptions.ts:68
Defaults to true. If true, automatically opens the cell editor when a cell gains focus.
autoHeight?
optionalautoHeight:boolean
Defined in: src/core/gridoptions.ts:73
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:78
CSS class applied to cells with a flashing effect. Default is "flashing".
columns?
optionalcolumns:Column<TItem>[]
Defined in: src/core/gridoptions.ts:88
Array of column definitions for the grid.
createPreHeaderPanel?
optionalcreatePreHeaderPanel:boolean
Defined in: src/core/gridoptions.ts:93
Deprecated
Use showGroupingPanel option instead.
dataItemColumnValueExtractor()?
optionaldataItemColumnValueExtractor: (item,column) =>void
Defined in: src/core/gridoptions.ts:98
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:103
Defaults to 80. Default width of columns in pixels.
defaultFormat?
optionaldefaultFormat:ColumnFormat<TItem>
Defined in: src/core/gridoptions.ts:108
Default formatting options for columns. Default is defaultColumnFormat.
defaultFormatter?
optionaldefaultFormatter:CompatFormatter<TItem>
Defined in: src/core/gridoptions.ts:113
Default formatter function for cells.
editable?
optionaleditable:boolean
Defined in: src/core/gridoptions.ts:118
Defaults to false. If true, cells can be edited inline.
editCommandHandler()?
optionaleditCommandHandler: (item,column,command) =>void
Defined in: src/core/gridoptions.ts:123
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:128
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:133
Factory function for creating custom editors. Default is null.
editorLock?
optionaleditorLock:EditorLock
Defined in: src/core/gridoptions.ts:138
Global editor lock instance, used for managing concurrent editor access. Default is GlobalEditorLock.
emptyNode()?
optionalemptyNode: (node) =>void
Defined in: src/core/gridoptions.ts:83
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:143
Defaults to false. If true, enables the ability to add new rows to the grid.
enableAsyncPostRender?
optionalenableAsyncPostRender:boolean
Defined in: src/core/gridoptions.ts:148
Defaults to false. If true, enables asynchronous post-rendering.
enableAsyncPostRenderCleanup?
optionalenableAsyncPostRenderCleanup:boolean
Defined in: src/core/gridoptions.ts:153
Defaults to false. If true, enables cleanup after asynchronous post-rendering.
enableCellNavigation?
optionalenableCellNavigation:boolean|"row"
Defined in: src/core/gridoptions.ts:165
Defaults to true. If true, enables cell navigation with arrow keys: the grid has an active cell, the
cursor, which the arrow keys, Tab, Home and End move between the cells.
"row" makes the cursor a row instead, e.g. for a list whose rows open a dialog: Up, Down, Page Up,
Page Down, Home and End move it between the rows, Left and Right scroll the columns, and Tab leaves the
grid. The grid still has an active cell, on the row of the cursor, so the active cell API, its events and
a selection model that follows it work the same, but its cell is not marked; the row is, through the
slick-row-navigation class of the container, which this value sets.
enableCellRangeSelection?
optionalenableCellRangeSelection:boolean
Defined in: src/core/gridoptions.ts:170
Defaults to false. If true, allows selection of cell ranges.
enableColumnReorder?
optionalenableColumnReorder:boolean
Defined in: src/core/gridoptions.ts:175
Defaults to true. If true, enables column reordering.
enableHtmlRendering?
optionalenableHtmlRendering:boolean
Defined in: src/core/gridoptions.ts:181
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:186
Defaults to false. If true, enables row reordering.
enableTabKeyNavigation?
optionalenableTabKeyNavigation:boolean
Defined in: src/core/gridoptions.ts:191
Defaults to true. If true, enables navigation between cells using the Tab key.
enableTextSelectionOnCells?
optionalenableTextSelectionOnCells:boolean
Defined in: src/core/gridoptions.ts:196
Defaults to false. If true, enables text selection within cells.
endPaneScrollbar?
optionalendPaneScrollbar:boolean
Defined in: src/core/gridoptions.ts:36
Defaults to true. Whether the vertical scrollbar is shown at the far end of the grid, after the columns that are
pinned to the end, instead of between them and the scrolling columns. The pane of the pinned columns then has the
scrollbar, and the main pane reaches under it, so that its own scrollbar is covered. It only applies to a grid that
has columns pinned to the end, and not to one with autoHeight. The container of the grid gets the sg-vbar-end
class while it applies.
explicitInitialization?
optionalexplicitInitialization:boolean
Defined in: src/core/gridoptions.ts:201
Defaults to false. If true, requires explicit initialization of the grid.
fillRows?
optionalfillRows:boolean
Defined in: src/core/gridoptions.ts:43
Defaults to true. Whether the rows fill the width of the main pane when the columns are narrower than it, with an
empty slick-cell sg-fill cell after the last column, so that the lines, the stripes and the fills of the rows reach
the columns that are pinned to the end, or the end of the grid. The container gets the sg-fill-rows class.
footerRowHeight?
optionalfooterRowHeight:number
Defined in: src/core/gridoptions.ts:206
Defaults to null which means the footer row height is calculated based on CSS rules.
forceFitColumns?
optionalforceFitColumns:boolean
Defined in: src/core/gridoptions.ts:211
Defaults to false. If true, forces columns to fit the grid width.
forceSyncScrolling?
optionalforceSyncScrolling:boolean
Defined in: src/core/gridoptions.ts:216
Defaults to false. If true, synchronizes scrolling between the grid and its container.
forceSyncScrollInterval?
optionalforceSyncScrollInterval:number
Defined in: src/core/gridoptions.ts:221
Defaults to 250. Interval in milliseconds for synchronizing scrolling when forceSyncScrolling is enabled.
formatterFactory?
optionalformatterFactory:FormatterFactory
Defined in: src/core/gridoptions.ts:226
Factory function for creating custom formatters. Default is null.
frozenBottom?
optionalfrozenBottom:number|boolean
Defined in: src/core/gridoptions.ts:232
Defaults to false. If true, requests frozen rows at the bottom edge of the grid.
Layouts without bottom-frozen row support leave frozenRows unfrozen.
frozenColumns?
optionalfrozenColumns:number
Defined in: src/core/gridoptions.ts:238
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:245
Defaults to undefined. If specified, freezes the given number of rows at the top, or at the
bottom when frozenBottom is true and the layout supports bottom-frozen rows. Otherwise,
those rows are left unfrozen when frozenBottom is true.
fullWidthRows?
optionalfullWidthRows:boolean
Defined in: src/core/gridoptions.ts:250
Defaults to false. If true, makes rows take the full width of the grid.
groupingPanel?
optionalgroupingPanel:boolean
Defined in: src/core/gridoptions.ts:255
Defaults to false. If true, shows the grouping panel for grouping columns.
groupingPanelHeight?
optionalgroupingPanelHeight:number
Defined in: src/core/gridoptions.ts:260
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:265
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:271
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:276
Defaults to null, e.g. calculated based on CSS. Height of the header row in pixels.
highlightActiveRow?
optionalhighlightActiveRow:boolean
Defined in: src/core/gridoptions.ts:363
Defaults to false. If true, the row of the active cell is highlighted as well as the cell, e.g.
for a grid that is edited a row at a time, where the row that has the cursor is the one being edited.
It only shows when a style tells what the highlight is, e.g. through the slick-highlight-active-row
class of the container, which this option sets.
jQuery?
optionaljQuery:object
Defined in: src/core/gridoptions.ts:281
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:291
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:286
Defaults to false. If true, leaves space for new rows in the DOM visible buffer.
minBuffer?
optionalminBuffer:number
Defined in: src/core/gridoptions.ts:296
Defaults to 3. Minimum number of rows to keep in the buffer.
multiColumnSort?
optionalmultiColumnSort:boolean
Defined in: src/core/gridoptions.ts:301
Defaults to false. If true, allows sorting by multiple columns simultaneously.
multiSelect?
optionalmultiSelect:boolean
Defined in: src/core/gridoptions.ts:306
Defaults to true. If true, enables multiple cell selection.
preHeaderPanelHeight?
optionalpreHeaderPanelHeight:number
Defined in: src/core/gridoptions.ts:311
Deprecated
Use groupingPanelHeight option instead.
removeNode()?
optionalremoveNode: (node) =>void
Defined in: src/core/gridoptions.ts:329
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:316
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:324
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:334
Defaults to 30. Height of rows in pixels.
rtl?
optionalrtl:boolean
Defined in: src/core/gridoptions.ts:339
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:345
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:350
CSS class applied to selected cells. Default is "selected".
showCellSelection?
optionalshowCellSelection:boolean
Defined in: src/core/gridoptions.ts:355
Defaults to true. If true, shows cell selection indicators.
showColumnHeader?
optionalshowColumnHeader:boolean
Defined in: src/core/gridoptions.ts:368
Defaults to true. If true, displays the column header.
showFooterRow?
optionalshowFooterRow:boolean
Defined in: src/core/gridoptions.ts:373
Defaults to false. If true, displays the footer row.
showGroupingPanel?
optionalshowGroupingPanel:boolean
Defined in: src/core/gridoptions.ts:378
Defaults to false. If true, displays the grouping panel.
showHeaderRow?
optionalshowHeaderRow:boolean
Defined in: src/core/gridoptions.ts:383
Defaults to false. If true, displays the header row.
showPreHeaderPanel?
optionalshowPreHeaderPanel:boolean
Defined in: src/core/gridoptions.ts:388
Deprecated
Use showGroupingPanel option instead.
showTopPanel?
optionalshowTopPanel:boolean
Defined in: src/core/gridoptions.ts:393
Defaults to false. If true, displays the post-header panel for additional controls or information.
styleNonce?
optionalstyleNonce:string
Defined in: src/core/gridoptions.ts:405
Nonce value for CSP (Content Security Policy) when useCssVars is false. Applied to the dynamically
created <style> element to allow inline CSS injection without violating CSP rules.
If not provided, the grid will attempt to detect a nonce from a meta element with csp-nonce name or from existing <style> or <script> elements on the page.
suppressActiveCellChangeOnEdit?
optionalsuppressActiveCellChangeOnEdit:boolean
Defined in: src/core/gridoptions.ts:398
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:410
Defaults to false. If true, synchronizes column resizing with cell resizing.
topPanelHeight?
optionaltopPanelHeight:number
Defined in: src/core/gridoptions.ts:415
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:432
Defaults to true which is equivalent to 100. If true, uses CSS variables for styling (for up to 100 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 100 columns by default.
But if you defined your own stylesheet with more columns, you can set this to a higher number.
If set to false, uses a dynamic <style> element (with optional styleNonce for CSP) to inject CSS rules
for positioning, avoiding inline styles entirely.
useLegacyUI?
optionaluseLegacyUI:boolean
Defined in: src/core/gridoptions.ts:420
Deprecated
This option has no effect.
viewportClass?
optionalviewportClass:string
Defined in: src/core/gridoptions.ts:437
CSS class applied to the viewport container. Default is undefined.