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 Nienow | Antarctica | Opera | iOS | 53 |
| Felix Mueller | South America | Opera | Mac OS | 35 |
| Kianna Dibbert | Australia | Safari | Android | 42 |
| Patrick McLaughlin | Africa | Internet Explorer | Android | 38 |
| Adelia Smith | South America | Firefox | Mac OS | 33 |
| Tyra Lebsack | Asia | Firefox | Ubuntu | 13 |
| Imelda Crist | South America | Firefox | Ubuntu | 68 |
| Mathew Welch | Asia | Opera | Android | 22 |
| Vaughn Hilpert | Africa | Internet Explorer | Android | 79 |
| Ivy Williamson | Asia | Opera | Ubuntu | 78 |
| Aileen Keebler | Africa | Chrome | Ubuntu | 45 |
| Rudy McClure | Africa | Edge | Android | 96 |
| Emory Kirlin | South America | Edge | Ubuntu | 33 |
| Dorthy Hegmann | Africa | Firefox | Android | 18 |
| Martina Nienow | Australia | Firefox | Mac OS | 6 |
| Rodrick Langworth | Asia | Safari | Android | 41 |
| Ettie Schaden | Europe | Internet Explorer | Ubuntu | 56 |
| Rogers Kuvalis | North America | Chrome | Mac OS | 66 |
| Drake Johnston | Australia | Firefox | Android | 38 |
| Rubye Mueller | Australia | Opera | Ubuntu | 19 |
| Adriel Schumm | Africa | Chrome | Windows | 85 |
| Luigi Leannon | South America | Firefox | Windows | 93 |
| Ludie Schinner | Asia | Opera | Android | 41 |
| Selina Kilback | Australia | Opera | Ubuntu | 50 |
| Drake Willms | Europe | Safari | Ubuntu | 11 |
| Rico Boyle | Europe | Edge | Android | 90 |
| Joey Sporer | South America | Safari | Mac OS | 92 |
| Wava Miller | South America | Safari | Mac OS | 77 |
| Annette Jacobson | Africa | Internet Explorer | Android | 44 |
| Harmon Strosin | Europe | Chrome | iOS | 65 |
| Dariana Gleason | Antarctica | Chrome | iOS | 25 |
| Zack Kunde | North America | Opera | Windows | 57 |
| Giovanni Cronin | Africa | Opera | Mac OS | 6 |
| Elbert Adams | North America | Opera | Android | 34 |
| Saul Botsford | North America | Internet Explorer | Ubuntu | 52 |
| Sydnee Pollich | South America | Opera | Android | 25 |
| Mohamed Ankunding | Australia | Safari | Mac OS | 26 |
| Rex Thompson | Europe | Safari | Android | 48 |
| Martin Zboncak | Asia | Opera | Mac OS | 85 |
| Unique Hilpert | Asia | Safari | Ubuntu | 71 |
| Jarvis Mante | Asia | Firefox | Mac OS | 12 |
| Ronny Crona | Antarctica | Edge | Android | 51 |
| Mack Mohr | North America | Opera | iOS | 46 |
| Rahsaan Considine | Australia | Safari | Android | 90 |
| Darryl Pacocha | Australia | Firefox | Android | 26 |
| Kristopher Dooley | Africa | Safari | Windows | 70 |
| Shany Lowe | Asia | Edge | Windows | 59 |
| Walton Lebsack | Africa | Internet Explorer | Android | 71 |
| Ernie Ullrich | Asia | Firefox | Windows | 20 |
| Adah Blick | South America | Firefox | Mac OS | 99 |
| Marta Armstrong | Asia | Firefox | Ubuntu | 82 |
| Trinity Berge | Asia | Edge | Ubuntu | 89 |
| Deondre Wyman | North America | Internet Explorer | Ubuntu | 2 |
| Akeem Donnelly | North America | Safari | Mac OS | 64 |
| Horacio West | South America | Safari | Ubuntu | 76 |
| Ryley Klein | Africa | Safari | Android | 65 |
| Richard Murphy | Australia | Chrome | Mac OS | 12 |
| Gloria Effertz | South America | Opera | Android | 16 |
| Sydnie Reynolds | Europe | Opera | Mac OS | 22 |
| Logan Bergstrom | Africa | Firefox | Android | 18 |
| Brandy McGlynn | Europe | Chrome | Ubuntu | 38 |
| Madonna Jakubowski | Australia | Safari | Mac OS | 90 |
| Jesse Kerluke | Africa | Chrome | Ubuntu | 19 |
| Alvina Beatty | North America | Safari | Ubuntu | 14 |
| Herminio Casper | North America | Opera | Android | 61 |
| Tia Upton | Asia | Safari | Ubuntu | 22 |
| Maxie Nader | Europe | Edge | Android | 89 |
| Bailey Langworth | Australia | Edge | Mac OS | 42 |
| Wade Kihn | Antarctica | Internet Explorer | Android | 69 |
| Gavin Smitham | Europe | Chrome | Mac OS | 94 |
| Columbus Wilderman | Africa | Safari | iOS | 99 |
| Jamar Beier | North America | Firefox | Ubuntu | 87 |
| Royce Mayer | Asia | Internet Explorer | Windows | 85 |
| Jillian Upton | North America | Firefox | Android | 73 |
| Marcos Torphy | Asia | Firefox | Ubuntu | 38 |
| Arlene Heidenreich | South America | Internet Explorer | Mac OS | 9 |
| Una Schuppe | Africa | Safari | Ubuntu | 66 |
| Freddy Monahan | Africa | Firefox | iOS | 18 |
| Edd Nitzsche | North America | Internet Explorer | Android | 58 |
| Marge Smith | South America | Firefox | Mac OS | 8 |
| Jonas Klocko | Australia | Internet Explorer | Mac OS | 40 |
| Noemy Hills | South America | Edge | Mac OS | 43 |
| Sherman Durgan | North America | Chrome | Mac OS | 3 |
| Allene Schaden | Africa | Opera | Windows | 68 |
| Adela Larson | North America | Firefox | iOS | 93 |
| Fernando Sipes | Asia | Internet Explorer | iOS | 78 |
| Ralph Bogan | Antarctica | Edge | Ubuntu | 8 |
| Camden Welch | North America | Opera | iOS | 52 |
| Krystel Windler | North America | Firefox | Mac OS | 65 |
| Shaniya Gerhold | Australia | Edge | Ubuntu | 16 |
| Gene Runolfsdottir | Asia | Internet Explorer | Ubuntu | 3 |
| Jaeden Shanahan | Europe | Opera | Ubuntu | 75 |
| Bernadette Willms | Africa | Chrome | Ubuntu | 10 |
| Nicola Cole | Australia | Safari | Ubuntu | 58 |
| Hipolito Grimes | Asia | Firefox | Mac OS | 35 |
| Davion Conn | Europe | Firefox | iOS | 65 |
| Alfreda Turner | Europe | Firefox | Ubuntu | 87 |
| Antonio Fay | Australia | Safari | Mac OS | 65 |
| Cassidy Oberbrunner | North America | Safari | iOS | 40 |
| Cheyanne Kohler | North America | Chrome | Mac OS | 75 |
| 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'}} />
GridColumnColumn HeaderGroupingDrag & Drop
| Property | Description | Type |
|---|---|---|
border | Set to | boolean |
buffered | Set to | boolean |
cached | Set to | 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 | string |
measureRowHeights | Used when rows have variable heights to improve buffered rendering by measuring
and caching rendered row heights. Default value is | boolean |
pageSize | Page size used to fetch records during infinite scrolling. Default value is | number |
records | An array of records to be displayed in the grid. | array |
scrollable | Set to | boolean |
selection | Selection configuration. See Selections for more details. | config |
sortDirection | A binding used to store the sort direction. Available only if | string |
sortField | A binding used to store the name of the field used for sorting grids. Available only if | string |
sorters | A binding used to store the sorting order list. Commonly used for server-side sorting. | array |
vlines | Set to | boolean |
allowsFileDrops | Set to | boolean |
bufferSize | Number of rendered rows in | number |
bufferStep | Number of rows to be scrolled before buffer adjustment. Default value is 15. | number |
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. | string/object |
columnParams | Whenever | 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 | string |
emptyText | Text to be displayed instead of an empty table. | string |
filterParams | Parameters which will be passed to the | object |
fixedFooter | Set to | boolean |
focusable | Set to | boolean |
groupingParams | Whenever | 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, | string/array |
onCreateFilter | Callback function used to create a filter. The function accepts | 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 | function |
onGetGrouping | Callback function to retrieve grouping data. Accepts | 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 | Used with outer layouts. Specifies the name of the content placeholder which should render the widget. | string |
remoteSort | Set to | boolean |
row | A parameter that allows defining multiple lines in a row.
Attributes of the | 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 | 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 | Visibility of the widget. Defaults to | boolean |