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
Cora WatersEuropeFirefoxAndroid39
Hollie PriceNorth AmericaSafariiOS92
Adelle HellerAustraliaSafariMac OS99
Cristal TrantowAntarcticaEdgeWindows23
Rodrick CarterAustraliaOperaMac OS84
Rosalinda KovacekEuropeSafariMac OS26
Walter DooleyAustraliaInternet ExplorerAndroid62
Orland SteuberAustraliaFirefoxUbuntu61
Stewart CummingsAustraliaOperaiOS43
Lacey HaleyNorth AmericaFirefoxUbuntu15
Alvera BruenAfricaInternet ExplorerUbuntu14
Leland DooleyEuropeFirefoxUbuntu99
Hosea DanielSouth AmericaInternet ExplorerMac OS66
Rylee MuellerNorth AmericaSafariMac OS49
Meda WolffAntarcticaFirefoxMac OS48
Kenyatta RosenbaumAsiaInternet ExplorerMac OS81
Nadia HellerAustraliaFirefoxWindows6
Tate SpencerSouth AmericaEdgeMac OS68
Jamey LindgrenSouth AmericaOperaMac OS32
Breana WymanEuropeOperaMac OS92
Rubie FayNorth AmericaInternet ExplorerAndroid6
Tyreek MacejkovicAfricaChromeUbuntu80
Milan ParkerAsiaEdgeAndroid20
Justus PurdyNorth AmericaFirefoxUbuntu83
Rolando FeilSouth AmericaOperaiOS4
London SchummAsiaSafariAndroid24
Tracey KlingSouth AmericaSafariMac OS11
Kaycee PredovicSouth AmericaEdgeUbuntu17
Cathy KihnEuropeOperaWindows43
Shad BartellSouth AmericaOperaUbuntu42
Dominic KochAsiaSafariMac OS52
Vallie AltenwerthSouth AmericaChromeAndroid69
Alexzander HarberSouth AmericaChromeAndroid80
Zola WindlerSouth AmericaFirefoxUbuntu79
Caleb StoltenbergAfricaSafariWindows60
Larissa RippinAfricaOperaAndroid47
Dayton McKenzieNorth AmericaInternet ExplorerUbuntu42
Jolie ConsidineAsiaInternet ExplorerUbuntu11
Kennith RatkeAustraliaFirefoxMac OS43
Jayme GoyetteAustraliaInternet ExplorerMac OS61
Irma ConnellySouth AmericaChromeAndroid42
Sim CarrollAfricaOperaUbuntu5
Otilia ShieldsEuropeInternet ExplorerMac OS91
Leone HoweAntarcticaSafariMac OS76
Gordon JaskolskiAfricaOperaAndroid92
Isai StarkNorth AmericaSafariAndroid98
Kayli HilllNorth AmericaSafariAndroid31
Donna ThompsonAsiaSafariAndroid39
Ramon KirlinEuropeOperaAndroid72
Maryse KuphalAntarcticaFirefoxAndroid26
Lucie PredovicAsiaFirefoxUbuntu19
Felicity RauSouth AmericaOperaUbuntu72
Josiah WiegandAustraliaEdgeUbuntu37
Alysa ConnSouth AmericaSafariAndroid36
Gino HauckAsiaEdgeAndroid32
Bernadette GrahamAsiaOperaAndroid66
Joseph TillmanAfricaEdgeMac OS75
Raven AufderharNorth AmericaSafariUbuntu95
Orville WeberAfricaChromeUbuntu76
Landen CummingsAustraliaInternet ExplorerMac OS37
Barton RunolfssonAfricaInternet ExplorerWindows60
Jerad ReingerAustraliaOperaAndroid52
Arianna PaucekAfricaFirefoxUbuntu30
Reina KrajcikAntarcticaEdgeAndroid76
Yoshiko ZemlakAustraliaSafariWindows48
Bernice GibsonAfricaInternet ExplorerAndroid30
Jeanie ConnellyAfricaOperaAndroid37
Jamil DachSouth AmericaOperaMac OS15
Stanford StehrSouth AmericaSafariAndroid77
Nella DickensAntarcticaFirefoxiOS23
Lazaro MarquardtAfricaOperaiOS43
Lawson KundeSouth AmericaFirefoxWindows23
Caesar HagenesAustraliaInternet ExplorerUbuntu38
Adan RiceAfricaInternet ExplorerUbuntu89
Melyssa TurcotteAsiaSafariiOS86
Adriel CorkerySouth AmericaFirefoxMac OS5
Tyree KirlinAsiaOperaAndroid47
Alysa NicolasAustraliaInternet ExplorerAndroid20
Beatrice MooreAsiaSafariiOS9
Keagan BlickAntarcticaFirefoxAndroid54
Vivienne JaskolskiSouth AmericaFirefoxAndroid67
Tania OndrickaAustraliaSafariAndroid99
Lavon CorkeryAsiaInternet ExplorerMac OS19
Stephan GrimesNorth AmericaFirefoxUbuntu20
Kennith ZulaufAsiaInternet ExplorerMac OS82
Leslie WeberAustraliaFirefoxiOS62
Hosea ChristiansenAsiaOperaUbuntu58
Domenica GusikowskiAustraliaInternet ExplorerUbuntu18
Laurie AbshireAntarcticaOperaMac OS4
Buddy SchmelerAustraliaInternet ExplorerMac OS46
Baby HackettAustraliaOperaAndroid78
Diamond GottliebEuropeInternet ExplorerWindows30
Kayli WalshAsiaChromeAndroid92
Raheem AnkundingSouth AmericaEdgeAndroid81
Rita TremblayAustraliaSafariAndroid79
Jonatan MetzNorth AmericaChromeUbuntu88
Aliza ReynoldsNorth AmericaFirefoxUbuntu13
Kenny WeimannEuropeFirefoxAndroid34
Rosemary BogisichAfricaChromeAndroid24
Aylin RobelAustraliaInternet ExplorerAndroid62
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