You're viewing the legacy site. Visit cxjs.io/docs for the latest documentation. Legacy site. Visit cxjs.io/docs for new docs.

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
Elsa KlingAsiaChromeiOS90
Sylvia HarveyAfricaFirefoxUbuntu16
Diego BalistreriAustraliaChromeAndroid35
Dock MillsSouth AmericaFirefoxWindows80
Javier SengerNorth AmericaFirefoxAndroid38
Emmitt MillsSouth AmericaSafariAndroid45
Justyn KundeAustraliaInternet ExplorerMac OS97
Nedra LarkinNorth AmericaSafariMac OS18
Blanche GleichnerAfricaChromeAndroid24
Marcelina OrtizSouth AmericaOperaiOS2
Connie WunschAustraliaFirefoxUbuntu54
Monique MillsAsiaFirefoxMac OS67
Jovani SchummAsiaFirefoxUbuntu40
Elbert HesselSouth AmericaFirefoxiOS75
Joseph SmithAfricaOperaUbuntu45
Wayne GrimesAustraliaInternet ExploreriOS90
Joan WeissnatAustraliaSafariMac OS53
Jermaine HoweAntarcticaSafariWindows16
Madisyn DaughertyAfricaInternet ExplorerMac OS76
Claudie GleichnerAfricaSafariAndroid34
Sigmund ConnAfricaFirefoxAndroid36
Lazaro TorphyAfricaOperaMac OS60
Soledad MacejkovicEuropeInternet ExplorerMac OS99
Forrest OberbrunnerAustraliaSafariAndroid35
Ardith KertzmannNorth AmericaSafariUbuntu26
Jairo WeberSouth AmericaSafariAndroid11
Victoria FeilAustraliaChromeMac OS60
Kadin WalterNorth AmericaSafariMac OS32
Maverick ReynoldsNorth AmericaInternet ExplorerAndroid14
Carlie DareAntarcticaSafariAndroid26
Pat KemmerAfricaFirefoxUbuntu70
Delfina HellerAntarcticaInternet ExploreriOS90
Greyson KovacekAustraliaSafariUbuntu3
Palma HoegerAustraliaOperaAndroid7
Tina KozeyNorth AmericaFirefoxUbuntu100
Vita MorissetteAustraliaOperaUbuntu26
Waino QuitzonSouth AmericaFirefoxAndroid58
Hillard ShanahanSouth AmericaEdgeWindows64
Bessie CartwrightEuropeInternet ExplorerUbuntu24
Daren CreminAsiaFirefoxAndroid30
Fannie KerlukeSouth AmericaFirefoxMac OS5
Abelardo OsinskiAfricaFirefoxiOS12
Vida KeeblerNorth AmericaInternet ExplorerUbuntu36
Pattie KrisAustraliaSafariMac OS76
Terrill HoegerAustraliaSafariUbuntu41
Sydni MurazikNorth AmericaInternet ExplorerUbuntu61
Kaitlyn MonahanSouth AmericaFirefoxAndroid90
Timmy CasperAsiaInternet ExplorerMac OS6
Tessie CummingsNorth AmericaOperaUbuntu71
Elinor ConnellyEuropeEdgeiOS25
Marguerite YostAntarcticaSafariiOS22
Rhea ChristiansenEuropeSafariMac OS94
Adolfo CormierEuropeEdgeiOS34
Orlando SporerAsiaFirefoxMac OS18
Coby StreichAsiaOperaAndroid15
Spencer CreminAfricaOperaMac OS84
Eliza WolfAustraliaOperaAndroid46
Isaac KiehnSouth AmericaFirefoxWindows64
Presley KassulkeAsiaOperaUbuntu54
Malinda MullerAfricaOperaAndroid44
Anabelle BednarAustraliaSafariMac OS5
Elouise McDermottNorth AmericaSafariiOS62
Kenna LangNorth AmericaInternet ExploreriOS83
Eldora PfannerstillNorth AmericaChromeWindows84
Josefa SpencerSouth AmericaOperaAndroid87
Hildegard JacobsAfricaInternet ExploreriOS39
Candido HesselAustraliaInternet ExplorerAndroid85
Marlin HarrisAsiaOperaAndroid58
Humberto FarrellSouth AmericaChromeMac OS56
Maddison PowlowskiAfricaInternet ExplorerAndroid34
Sammie KshlerinSouth AmericaSafariWindows73
Maymie MullerSouth AmericaSafariAndroid55
Orville ZiemannAsiaFirefoxAndroid97
Marcus GibsonAfricaSafariMac OS22
Destiny SchmelerEuropeChromeUbuntu6
Electa ZiemannNorth AmericaFirefoxMac OS39
Ada PadbergSouth AmericaSafariMac OS95
Kaya KeelingAsiaInternet ExplorerWindows6
Howell SwaniawskiAsiaOperaiOS54
Frieda NolanSouth AmericaInternet ExploreriOS34
Katlyn ArmstrongNorth AmericaInternet ExplorerUbuntu14
Cole SipesSouth AmericaOperaUbuntu65
Toni CronaAfricaEdgeMac OS88
Josefina GloverNorth AmericaOperaUbuntu35
Phyllis UptonAustraliaInternet ExplorerUbuntu74
Evalyn SchowalterNorth AmericaSafariAndroid45
Mathew LefflerEuropeEdgeAndroid73
Kris YundtAustraliaInternet ExplorerMac OS80
Nathen MitchellSouth AmericaInternet ExplorerMac OS16
Marcelle BeattyAfricaInternet ExplorerAndroid44
Ned FarrellAfricaFirefoxMac OS24
Ryleigh SkilesSouth AmericaOperaAndroid87
Skye KilbackEuropeSafariUbuntu59
Blake MacejkovicSouth AmericaChromeMac OS59
Peter FadelAustraliaInternet ExplorerAndroid27
Marietta BorerAsiaFirefoxiOS65
Daisha KonopelskiAntarcticaFirefoxiOS50
Mazie FritschAustraliaOperaAndroid33
Johnny UllrichAfricaOperaUbuntu59
Cassie SchowalterAfricaInternet ExplorerUbuntu76
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