Documentation

Report Edit

Grid

import {Grid} from 'cx/widgets';

Grid is a versatile component used to display tabular data. Grid control in Cx has many features such as fixed headers, single and multiple selection modes, sorting, filtering, grouping and aggregation, rich cell content (including headers), tree columns, etc.

Name
Continent
Browser
OS
Visits
Clovis NienowAntarcticaOperaiOS53
Felix MuellerSouth AmericaOperaMac OS35
Kianna DibbertAustraliaSafariAndroid42
Patrick McLaughlinAfricaInternet ExplorerAndroid38
Adelia SmithSouth AmericaFirefoxMac OS33
Tyra LebsackAsiaFirefoxUbuntu13
Imelda CristSouth AmericaFirefoxUbuntu68
Mathew WelchAsiaOperaAndroid22
Vaughn HilpertAfricaInternet ExplorerAndroid79
Ivy WilliamsonAsiaOperaUbuntu78
Aileen KeeblerAfricaChromeUbuntu45
Rudy McClureAfricaEdgeAndroid96
Emory KirlinSouth AmericaEdgeUbuntu33
Dorthy HegmannAfricaFirefoxAndroid18
Martina NienowAustraliaFirefoxMac OS6
Rodrick LangworthAsiaSafariAndroid41
Ettie SchadenEuropeInternet ExplorerUbuntu56
Rogers KuvalisNorth AmericaChromeMac OS66
Drake JohnstonAustraliaFirefoxAndroid38
Rubye MuellerAustraliaOperaUbuntu19
Adriel SchummAfricaChromeWindows85
Luigi LeannonSouth AmericaFirefoxWindows93
Ludie SchinnerAsiaOperaAndroid41
Selina KilbackAustraliaOperaUbuntu50
Drake WillmsEuropeSafariUbuntu11
Rico BoyleEuropeEdgeAndroid90
Joey SporerSouth AmericaSafariMac OS92
Wava MillerSouth AmericaSafariMac OS77
Annette JacobsonAfricaInternet ExplorerAndroid44
Harmon StrosinEuropeChromeiOS65
Dariana GleasonAntarcticaChromeiOS25
Zack KundeNorth AmericaOperaWindows57
Giovanni CroninAfricaOperaMac OS6
Elbert AdamsNorth AmericaOperaAndroid34
Saul BotsfordNorth AmericaInternet ExplorerUbuntu52
Sydnee PollichSouth AmericaOperaAndroid25
Mohamed AnkundingAustraliaSafariMac OS26
Rex ThompsonEuropeSafariAndroid48
Martin ZboncakAsiaOperaMac OS85
Unique HilpertAsiaSafariUbuntu71
Jarvis ManteAsiaFirefoxMac OS12
Ronny CronaAntarcticaEdgeAndroid51
Mack MohrNorth AmericaOperaiOS46
Rahsaan ConsidineAustraliaSafariAndroid90
Darryl PacochaAustraliaFirefoxAndroid26
Kristopher DooleyAfricaSafariWindows70
Shany LoweAsiaEdgeWindows59
Walton LebsackAfricaInternet ExplorerAndroid71
Ernie UllrichAsiaFirefoxWindows20
Adah BlickSouth AmericaFirefoxMac OS99
Marta ArmstrongAsiaFirefoxUbuntu82
Trinity BergeAsiaEdgeUbuntu89
Deondre WymanNorth AmericaInternet ExplorerUbuntu2
Akeem DonnellyNorth AmericaSafariMac OS64
Horacio WestSouth AmericaSafariUbuntu76
Ryley KleinAfricaSafariAndroid65
Richard MurphyAustraliaChromeMac OS12
Gloria EffertzSouth AmericaOperaAndroid16
Sydnie ReynoldsEuropeOperaMac OS22
Logan BergstromAfricaFirefoxAndroid18
Brandy McGlynnEuropeChromeUbuntu38
Madonna JakubowskiAustraliaSafariMac OS90
Jesse KerlukeAfricaChromeUbuntu19
Alvina BeattyNorth AmericaSafariUbuntu14
Herminio CasperNorth AmericaOperaAndroid61
Tia UptonAsiaSafariUbuntu22
Maxie NaderEuropeEdgeAndroid89
Bailey LangworthAustraliaEdgeMac OS42
Wade KihnAntarcticaInternet ExplorerAndroid69
Gavin SmithamEuropeChromeMac OS94
Columbus WildermanAfricaSafariiOS99
Jamar BeierNorth AmericaFirefoxUbuntu87
Royce MayerAsiaInternet ExplorerWindows85
Jillian UptonNorth AmericaFirefoxAndroid73
Marcos TorphyAsiaFirefoxUbuntu38
Arlene HeidenreichSouth AmericaInternet ExplorerMac OS9
Una SchuppeAfricaSafariUbuntu66
Freddy MonahanAfricaFirefoxiOS18
Edd NitzscheNorth AmericaInternet ExplorerAndroid58
Marge SmithSouth AmericaFirefoxMac OS8
Jonas KlockoAustraliaInternet ExplorerMac OS40
Noemy HillsSouth AmericaEdgeMac OS43
Sherman DurganNorth AmericaChromeMac OS3
Allene SchadenAfricaOperaWindows68
Adela LarsonNorth AmericaFirefoxiOS93
Fernando SipesAsiaInternet ExploreriOS78
Ralph BoganAntarcticaEdgeUbuntu8
Camden WelchNorth AmericaOperaiOS52
Krystel WindlerNorth AmericaFirefoxMac OS65
Shaniya GerholdAustraliaEdgeUbuntu16
Gene RunolfsdottirAsiaInternet ExplorerUbuntu3
Jaeden ShanahanEuropeOperaUbuntu75
Bernadette WillmsAfricaChromeUbuntu10
Nicola ColeAustraliaSafariUbuntu58
Hipolito GrimesAsiaFirefoxMac OS35
Davion ConnEuropeFirefoxiOS65
Alfreda TurnerEuropeFirefoxUbuntu87
Antonio FayAustraliaSafariMac OS65
Cassidy OberbrunnerNorth AmericaSafariiOS40
Cheyanne KohlerNorth AmericaChromeMac OS75
Name
Continent
Browser
OS
Visits
<Grid records-bind='$page.records'
    style={{width: "100%"}}
    columns={[
        { header: 'Name', field: 'fullName', sortable: true },
        { header: 'Continent', field: 'continent', sortable: true },
        { header: 'Browser', field: 'browser', sortable: true },
        { header: 'OS', field: 'os', sortable: true },
        { header: 'Visits', field: 'visits', sortable: true, primarySortDirection: 'DESC' }
    ]}
    selection={{type: KeySelection, bind:'$page.selection'}}
/>
Copied!Cx Fiddle

GridColumnColumn HeaderGroupingDrag & Drop

PropertyDescriptionType
border

Set to true to add default border around the table. Automatically set if grid is scrollable.

boolean
buffered

Set to true to render only visible rows on the screen. This greatly improves performance for grids with a lot of data. Works only if the grid is scrollable.

boolean
cached

Set to true to enable row caching. This greatly improves grid performance on subsequent render operations, however, only changes on records are allowed. If grid rows display any data outside records, changes on that data will not be caught.

boolean
clearableSort

If set, clicking on the column header will loop between ASC, DESC and no sorting order, instead of ASC and DESC only.

boolean
columns

An array of columns. Check column configuration options in the section below.

array
grouping

An array of grouping level definitions. Check allowed grouping level properties in the section below.

array
headerMode

Determines header appearance. Supported values are plain and default. Default mode is used if some of the columns are sortable. Plain mode better suits reports and other scenarios in which users do not interact with the grid.

string
measureRowHeights

Used when rows have variable heights to improve buffered rendering by measuring and caching rendered row heights. Default value is false.

boolean
pageSize

Page size used to fetch records during infinite scrolling. Default value is 100.

number
records

An array of records to be displayed in the grid.

array
scrollable

Set to true to add a vertical scroll and a fixed header to the grid. Scrollable grids shoud have height or max-height set. Otherwise, the grid will grow to accomodate all rows.

boolean
selection

Selection configuration. See Selections for more details.

config
sortDirection

A binding used to store the sort direction. Available only if sorters are not used.

string
sortField

A binding used to store the name of the field used for sorting grids. Available only if sorters are not used.

string
sorters

A binding used to store the sorting order list. Commonly used for server-side sorting.

array
vlines

Set to true to add vertical gridlines.

boolean
allowsFileDrops

Set to true to allow the grid to receive drag and drop operations containing files.

boolean
bufferSize

Number of rendered rows in buffered grids. Default value is 60.

number
bufferStep

Number of rows to be scrolled before buffer adjustment. Default value is 15.

number
class
className

Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list.

string/object
columnParams

Whenever columnParams change, columns are recalculated using the onGetColumns callback.

object
dataAdapter

Data adapter is used for converting data in a list of records. Used to enable grouping and tree operations. See TreeGrid for more details.

object
defaultSortDirection

Default sort direction.

string
defaultSortField

Default sort field. Used if neither sortField or sorters are set.

string
emptyText

Text to be displayed instead of an empty table.

string
filterParams

Parameters which will be passed to the onCreateFilter callback. Take a look at the example here.

object
fixedFooter

Set to true to add a fixed footer at the bottom of the grid.

boolean
focusable

Set to true or false to explicitly define if grid is allowed to receive focus.

boolean
groupingParams

Whenever groupingParams change, columns are recalculated using the onGetGrouping callback.

object
hoverChannel

A value used to identify the group of components participating in hover effect synchronization. See HoverSync.

string
lockColumnWidths

Set to true to lock column widths after the first render. This is helpful in pagination scenarios to maintain consistent looks across pages.

boolean
mod

Appearance modifier. For example, mod="big" will add the CSS class .cxm-big to the block element.

string/array
onCreateFilter

Callback function used to create a filter. The function accepts filterParams as an argument and it should return a predicate function used to filter the records. Take a look at the example here.

function
onCreateIsRecordDraggable

Callback function used to specify which row is draggable. It should return a predicate which accepts a record and returns a boolean indicating wheter that record is draggable or not.

function
onCreateIsRecordSelectable

Callback function used to specify which row is selectable and which not.

function
onGetColumns

Callback function used to dynamically calculate columns. The function accepts resolved columnParams as a first argument and it should return either columns (array of column configurations) or row (grid row configuration) for multi-line scenarios.

function
onGetGrouping

Callback function to retrieve grouping data. Accepts groupingParams as a first argument and should return a grid grouping configuration.

function
onRef

Callback function to get grid component and instance references on component init.

function
onRowClick

Callback function to be executed when a row is clicked.

function
onRowContextMenu

Callback function to be executed when a row is right-clicked.

function
onRowDoubleClick

Callback function to be executed when a row is double-clicked.

function
onRowKeyDown

Callback function to be executed on key down. Accepts instance of the currently focused record as the second argument.

function
onTrackMappedRecords

Callback function to track and retrieve displayed records. Accepts new records as a first argument. If onCreateFilter callback is defined, filtered records can be retrieved using this callback. See its usage in the example here.

function
outerLayout

Defines the outer layout which wraps the widget.

widget
preSorters

Additional sorters to be prepended to the actual list of sorters.

array
preserveGroupOrder

When enabled, groups are shown in the same order as the source records.

boolean
putInto
contentFor

Used with outer layouts. Specifies the name of the content placeholder which should render the widget.

string
remoteSort

Set to true if sorting is done remotely, on the server-side. Default value is false.

boolean
row

A parameter that allows defining multiple lines in a row. Attributes of the row object: line1 - defines the first line, line2 - defines the second line, style - style object applied to the wrapper div, class - additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list.

object
rowHoverId

A value used to uniquely identify the record within the hover sync group. See HoverSync.

string
scrollResetParams

Parameters whose change will cause the scroll to be reset.

object
scrollSelectionIntoView

Set to true to add ensure that selected record is automatically scrolled into the view on selection change.

boolean
sortOptions

Options for data sorting. See Intl.Collator options for more info.

record
style

Style object applied to the wrapper div. Used for setting the dimensions of the element.

string/object
vdomKey

Key that will be used as the key when rendering the React component.

string
visible
if

Visibility of the widget. Defaults to true.

boolean