API Reference

Declarative State Reference

LyteNyte Grid is a declarative grid. State changes drive the view. The grid state is a large object with all the reactive properties the grid will listen to.

The state values come in two forms - read-only or read/write. Readonly state values may only be interacted with, but can not be set. These values are normally derived state values. The read / write values may be set which will result in the grid updating and generally re-rendering what has changed.

All the state values have the following methods:

  • peek: a callback function that returns the current value of the state value.
  • watch: a subscribe function that will call a provided callback when the watched value changes .
  • use: a React hook to reactively listen to changes. Calls to use must obey the rules of React hooks.

Writable state values have an additional method:

  • set: which takes the new value for the state or a function that will compute the next value. The function form is passed the previous value as an argument.

Most pieces of state are writable. If you try setting a read only state item you will get a type error.

Aggregation

aggFns

Specifies the available aggregation functions that can be used within the grid. Each key in the object represents the name of an aggregation function, and the corresponding value is the implementation of that function.


Aggregation functions are used to calculate summary values for columns, such as sums, averages, or custom calculations based on the data in a column.

aggModel

Defines which aggregation function should be applied to each column in the grid. The keys in this object are column IDs, and the values are the names of aggregation functions that should be used for those columns.


The aggregation function names must correspond to keys in the aggFns object. When data is grouped or summarized, these functions will be applied to calculate aggregate values for each column.

Cell Editing

Key Types

The types for cell editing are:

type CellEditPointerActivator = "single-click" | "double-click" | "none";

cellEditPointerActivator

Determines when a cell should enter edit mode in response to pointer events. This function is called when a pointer event occurs on a cell, and returns a boolean indicating whether the cell should enter edit mode.


By providing a custom implementation, you can control the exact behavior that triggers cell editing, such as requiring a double-click, a specific key press, or any other custom activation logic.

cellEditProviders

Defines the available cell edit providers that can be used within the grid. Each key in the object represents the name of a cell edit provider, and the corresponding value is the implementation of that provider.


Cell edit providers determine how cells are edited, including the UI components that appear during editing, how values are validated, and how edits are committed or canceled. Different columns can use different edit providers based on their data types and editing requirements.

Cell Selection

cellSelectionsTag indicating the feature is only available for LyteNyte PRO

Defines the currently selected cells in the grid. This array contains selection rectangles that specify ranges of cells that are currently selected. Multiple selections can be active simultaneously, allowing for non-contiguous selection of cells.

cellSelectionModeTag indicating the feature is only available for LyteNyte PRO

Specifies how cell selection behaves in the grid. This property controls whether users can select individual cells, ranges of cells, entire rows, columns, or other selection patterns, and how these selections can be created or modified.

Cell Rendering

cellRenderers

Defines the available cell renderers that can be used within the grid. Each key in the object represents the name of a cell renderer, and the corresponding value is the implementation of that renderer.


Cell renderers control how the content of cells is displayed in the grid. Different columns can use different renderers based on their data types and display requirements, allowing for customized cell presentation throughout the grid.

Column

columnHeaderHeight

Specifies the height of column headers in the grid. This property controls the vertical space allocated for the headers of individual columns.

columnHeaderRenderers

Defines custom renderers for column headers in the grid. Each key in the object represents the name of a header renderer, and the corresponding value is the implementation of that renderer.


Custom header renderers allow you to control exactly how column headers are displayed, including custom formatting, icons, and interactive elements within the header area.

columnGroupHeaderHeight

Specifies the height of column group headers in the grid. This property controls the vertical space allocated for headers that represent groups of columns.

columnGroupHeaderRenderer

Specifies a custom renderer for column group headers. This renderer controls how the headers for column groups are displayed in the grid.


By providing a custom renderer, you can control the appearance and behavior of column group headers, including customizing the display of group names, adding collapse/expand controls, or including any other interactive elements.

columnGroupStickyHeaders

Determines whether column group headers should remain visible (sticky) when scrolling horizontally. When set to true, column group headers will remain fixed in position while the grid content scrolls.


This improves user experience by maintaining context about which column group is being viewed even when scrolling through wide datasets.

columnGroupIdDelimiter

Specifies the delimiter character used to separate levels in hierarchical column group IDs. This is used when constructing and parsing IDs for nested column groups.


For example, with a delimiter of "/", a column group ID might look like "region/country/city", representing a three-level hierarchy of column groups.

columnGroupExpansionState

Defines the current expansion state of column groups in the grid. The keys in this object are column group IDs, and the values are booleans indicating whether each group is expanded.


This allows for programmatic control over which column groups are expanded or collapsed at any given time, enabling features like "expand all" or "collapse all" operations.

columnGroupDefaultExpansion

A function that determines the default expansion state for a given column group. This function is called when a column group's expansion state is not explicitly defined in the columnGroupExpansionState object.


By providing a custom implementation, you can control which column groups are expanded by default based on their characteristics, such as level in the hierarchy or group name.

columnSpanScanDistance

Determines how far to scan when calculating column spans. This property defines the maximum number of columns to check when resolving spanning cells.


A larger value allows for wider spanning cells but may impact performance with very large grids. Typically, this value should be set to cover the maximum possible column span in the grid.

columns

Defines the columns to be displayed in the grid. This array contains column definitions that specify how each column should behave and appear.


Each column definition includes properties like the column's ID, title, width, renderer, and other configuration options that control the column's behavior and appearance.

columnBase

Specifies a base configuration for all columns in the grid. Properties defined in this object will be used as defaults for all columns, unless overridden by specific column definitions.


This allows for consistent column behavior across the grid while still allowing for customization of individual columns as needed.

Column Pivoting

columnPivotModeIsOnTag indicating the feature is only available for LyteNyte PRO

Determines whether column pivot mode is enabled for the grid. When set to true, the grid will pivot data according to the pivot model, transforming row values into columns for data analysis and cross-tabulation views.

columnPivotModelTag indicating the feature is only available for LyteNyte PRO

Specifies which columns are used to pivot the grid data. This array contains column IDs that will be used as pivot columns, where unique values in these columns will become new columns in the resulting pivoted view.

measureModelTag indicating the feature is only available for LyteNyte PRO

Defines which measure aggregation functions should be applied to columns in the grid during pivoting or grouping operations. The keys in this object are column IDs, and the values are the names of aggregation functions that should be used as measures for those columns.

Filtering

filterModel

Defines the current filter configuration for the grid. This object specifies which columns have active filters and the filter values or conditions for each column.


The filter model controls which rows are displayed in the grid based on filter criteria. It allows for complex filtering scenarios including multiple column filters that can be combined using logical operations.

filterQuickSearchTag indicating the feature is only available for LyteNyte PRO

Specifies the current text being used for quick search filtering across the grid. When set to a non-null string value, the grid will filter rows to show only those that contain the specified text in any searchable column. Setting this to null disables quick search filtering.

Floating Row

floatingRowEnabled

Determines whether the floating row feature is enabled in the grid. When set to true, the grid will display a floating row that can be used for summary information, input fields, or other custom content that should remain visible.


Floating rows provide a way to include persistent content that doesn't scroll with the main grid data, useful for totals, averages, or interactive elements like filters.

floatingRowHeight

Specifies the height of the floating row in the grid. This property controls the vertical space allocated for the floating row when it is enabled.


The height can be specified as a fixed number of pixels or using a more complex configuration that allows for different heights based on specific conditions or requirements.

floatingCellRenderers

Defines custom renderers for cells in the floating row. Each key in the object represents the name of a floating cell renderer, and the corresponding value is the implementation of that renderer.


Custom floating cell renderers allow you to control exactly how cells in the floating row are displayed, including custom formatting, interactive elements, and specialized content like summary calculations or input controls.

Rows

rowDataSource

Specifies the data source that provides row data to the grid. This defines how the grid retrieves, processes, and manages row data, supporting scenarios like virtualization, lazy-loading, and data pagination.

rowUpdateStackMaxSize

Defines the maximum number of row updates that can be stored in the update stack, which enables undo/redo functionality for changes to row data. When this limit is reached, older updates are removed.

rowUpdateStackEnabled

Determines whether the row update stack is enabled. When set to true, the grid will track changes to row data, allowing for operations like undo and redo.

rowDetailMarker

When set to true, displays a marker or indicator that can be clicked to expand or collapse the row detail section. This provides a visual cue that a row has additional detail content available.

rowDetailRenderer

Specifies a custom renderer for the detail section of a row. This renderer controls how the expanded detail content is displayed when a row is expanded to show additional information.

rowDetailEnabled

Determines whether row details are enabled for specific rows. This can be a boolean value applied to all rows or a function that evaluates each row individually to determine if it should have details available.

rowDetailHeight

Specifies the height of the detail section when a row is expanded. This can be a fixed height for all row details or a function that determines the height based on the specific row data.

rowDetailExpansions

A Set containing the IDs of rows that are currently expanded to show their detail section. This allows for programmatic control over which rows have their details visible.

rowDragEnabled

Determines whether row dragging is enabled in the grid. When set to true, users can drag rows to reorder them or move them between groups or grids.

rowDragMultiRow

When set to true, allows multiple rows to be selected and dragged as a group. This enables operations on multiple rows simultaneously through drag and drop.

rowDragExternalGrids

Specifies other grid instances that can participate in drag and drop operations with this grid. This enables dragging rows between separate grid instances.

rowDragPredicate

A function that determines whether a specific row can be dragged. This allows for fine-grained control over which rows are draggable based on row data or other conditions.

rowGroupAutoApplyAggDefaults

When set to true, the grid will automatically apply default aggregation functions to columns when rows are grouped, without requiring explicit configuration of the aggregation model.

rowGroupColumnTemplate

Defines a template for columns that are generated to display row group information. This controls the appearance and behavior of group columns when row grouping is active.

rowGroupModel

Specifies which columns are used for grouping rows. This array contains column IDs in the order they should be applied for hierarchical grouping.

rowGroupDisplayMode

Determines how grouped rows are displayed in the grid, such as whether grouped columns are hidden or shown alongside the generated group columns.

rowGroupDefaultExpansion

Controls the default expansion state of row groups. This can be a boolean that applies to all groups or a number representing the maximum depth to which groups should be expanded by default.

rowGroupExpansions

Defines which row groups are currently expanded. This allows for programmatic control over the expansion state of individual groups in the grid.

rowHeight

Specifies the height of rows in the grid. This can be a fixed height applied to all rows or a function that determines the height based on the specific row data.

rowSelectionCheckbox

Controls the display and behavior of checkboxes used for row selection. This can specify whether checkboxes are shown, their position, and appearance.

rowSelectionPointerActivator

Determines when a row should be selected in response to pointer events. This function controls the exact behavior that triggers row selection, such as click or click-and-drag.

rowSelectionMode

Specifies the row selection mode, such as whether single or multiple rows can be selected at once, and how selection behavior works when clicking on rows.

rowSelectionSelectedIds

A Set containing the IDs of rows that are currently selected. This allows for programmatic control over which rows are selected in the grid.

rowSelectionPredicate

Determines which rows can be selected. This can be a predefined value like "all", "group-only", "leaf-only", or a custom function that evaluates each row individually.

rowSelectionSelectChildren

When set to true, selecting a group row will automatically select all of its child rows. This applies to hierarchical data with parent-child relationships.

rowSelectionMultiSelectOnClick

When set to true, allows multiple rows to be selected by clicking on them individually without requiring modifier keys like Ctrl or Shift to be pressed.

rowSpanScanDistance

Determines how far to scan when calculating row spans. This property defines the maximum number of rows to check when resolving spanning cells.

rowFullWidthPredicate

A function that determines whether a specific row should be rendered using full width mode, which spans across all columns rather than being divided into cells.

rowFullWidthRenderer

Specifies a custom renderer for rows that are displayed in full width mode. This renderer controls how full width rows are displayed in the grid.

Pagination

paginate

Determines whether pagination is enabled for the grid. When set to true, the grid's data will be divided into pages with a specific number of rows per page, allowing users to navigate through large datasets more efficiently.

paginatePageSize

Specifies the number of rows to display per page when pagination is enabled. This controls how many rows are visible at once before requiring navigation to another page.

paginateCurrentPage

Indicates which page is currently displayed in the grid. Page numbering is zero-based, so the first page is represented by 0, the second page by 1, and so on.

Sorting

sortModel

Defines the current sort configuration for the grid. This array specifies which columns are being sorted and in what order (ascending or descending). Multiple sort criteria can be applied simultaneously for multi-level sorting.

sortComparatorFns

Provides custom comparison functions for sorting specific columns. This object maps column IDs to comparator functions that define how values in those columns should be compared when sorting, allowing for specialized sorting logic beyond the default comparisons.

Internationalization

rtl

Determines whether the grid uses right-to-left (RTL) text direction. When set to true, the grid layout and content flow will be reversed to support languages that are written from right to left, such as Arabic, Hebrew, and Persian.

Grid Identification

gridId

Specifies a unique identifier for the grid instance. This ID is used to distinguish between multiple grid instances in the same application and is required for operations like drag-and-drop between grids, state persistence, and programmatic grid interaction.

Overlays

overlayToShowTag indicating the feature is only available for LyteNyte PRO

Specifies which overlay, if any, should be displayed on top of the grid. This property can reference an overlay by ID or be set to null to hide all overlays. Overlays are useful for showing loading states, error messages, or custom information panels that cover the grid content.

overlaysTag indicating the feature is only available for LyteNyte PRO

Defines the available overlays that can be displayed on the grid. This object maps overlay IDs to their corresponding overlay configurations, allowing for multiple predefined overlays that can be shown or hidden as needed.

UI Components

contextMenuRendererTag indicating the feature is only available for LyteNyte PRO

Specifies a custom renderer for context menus in the grid. This renderer controls how context menus appear when triggered by right-clicking or using context menu keyboard shortcuts, allowing for fully customized menu content and behavior.

contextMenuPredicateTag indicating the feature is only available for LyteNyte PRO

A function that determines whether a context menu should be displayed for a specific cell or location in the grid. This allows for conditional display of context menus based on cell content, user permissions, or other factors.

columnMenuRendererTag indicating the feature is only available for LyteNyte PRO

Specifies a custom renderer for column header menus. This renderer controls the appearance and content of menus that appear when interacting with column headers, such as for sorting, filtering, or column operations.

panelFramesTag indicating the feature is only available for LyteNyte PRO

Defines custom panel components that can be displayed within the grid. Each key in this object represents a panel ID, and the corresponding value is the panel configuration. Panels provide a way to display complex UI components alongside or within the grid.

panelFrameButtonsTag indicating the feature is only available for LyteNyte PRO

Specifies buttons that should appear in the header area of panel frames. These buttons allow users to interact with or control panels, such as closing, minimizing, or performing specific actions related to the panel content.

dialogFramesTag indicating the feature is only available for LyteNyte PRO

Defines custom dialog components that can be displayed over the grid. Each key in this object represents a dialog ID, and the corresponding value is the dialog configuration. Dialogs provide modal interfaces for user interaction or information display.

popoverFramesTag indicating the feature is only available for LyteNyte PRO

Defines custom popover components that can be displayed near specific elements in the grid. Each key in this object represents a popover ID, and the corresponding value is the popover configuration. Popovers provide contextual information or controls related to specific grid elements.

menuFramesTag indicating the feature is only available for LyteNyte PRO

Defines custom menu components that can be displayed within the grid. Each key in this object represents a menu ID, and the corresponding value is the menu configuration. These menus can be used for custom dropdown or context menu implementations.