v7.3.0
SupportExamplesFree Trial

Grid
Widget

The Grid component is a very powerful and performant UI component that shows tabular data (or tree data using the TreeGrid).

Intro

The Grid widget has a wide range of features and a large API to allow users to work with data efficiently in the browser. The two most important configs are store and columns. With the store config, you decide which data to load into the grid. You can work with both in-memory arrays or load data using ajax. See the Store class to learn more about loading data into stores.

The columns config accepts an array of Column descriptors defining which fields that will be displayed in the grid. The field property in the column descriptor maps to a field in your dataset. The simplest grid configured with inline data and two columns would look like this:

 const grid = new Grid({
      appendTo : document.body,

columns: [ { field: 'name', text: 'Name' }, { field: 'job', text: 'Job', renderer: ({value}) => value || 'Unemployed' } ],

data: [ { name: 'Bill', job: 'Retired' }, { name: 'Elon', job: 'Visionary' }, { name: 'Me' } ] });

const App = props => {
    const [columns, setColumns] = useState([
         { field: 'name', text: 'Name' },
         { field: 'job', text: 'Job', renderer: ({value}) => value || 'Unemployed' }
    ]);

const [data, setData] = useState([ { name: 'Bill', job: 'Retired' }, { name: 'Elon', job: 'Visionary' }, { name: 'Me' } ]);

return <BryntumGrid column={columns} data={data} /> }

<bryntum-grid :columns="columns" :data="data" />
export default {
   setup() {
     return {
       columns : [
         { field: 'name', text: 'Name' },
         { field: 'job', text: 'Job', renderer: ({value}) => value || 'Unemployed' }
       ]
       data : reactive([
         { name: 'Bill', job: 'Retired' },
         { name: 'Elon', job: 'Visionary' },
         { name: 'Me' }
       ])
     };
   }
}

<bryntum-grid [columns]="columns" [data]="data"></bryntum-grid>
export class AppComponent {
     columns = [
         { field: 'name', text: 'Name' },
         { field: 'job', text: 'Job', renderer: ({value}) => value || 'Unemployed' }
     ]

data = [ { name: 'Bill', job: 'Retired' }, { name: 'Elon', job: 'Visionary' }, { name: 'Me' } ] }

// grid with basic configuration const grid = new Grid({ // makes grid as high as it needs to be to fit rows autoHeight : true, appendTo : targetElement, selectionMode : { row : true, checkbox : { region : 'locked' }, showCheckAll : true }, columns : [ { text : 'Id', field : 'id', width : 40, editor : false }, { id : 'contact', text : 'Contact', collapsible : true, collapsed : true, // This will toggle the hidden state for all children, to allow you to show a different column in // collapsed mode collapseMode : 'toggleAll', children : [ { text : 'First name', field : 'firstName', width : 150 }, { text : 'Surname', field : 'surName', width : 150 }, // This column is hidden by default, shown only when collapsing the parent column { text : 'Name', width : 150, renderer : ({ record }) => `${record.firstName} ${record.surName}`, toggleAllHidden : true } ] }, { id : 'other', text : 'Other info (not collapsible)', // Not collapsible, the default children : [ { text : 'Rating', field : 'rating', width : 100 }, { type : 'percent', text : 'Percent done', field : 'percent', width : 120 }, { text : 'Slider column', type : 'widget', width : 120, cls : 'slidercell', widgets : [ { type : 'slider', name : 'percent', showValue : false, showTooltip : true } ] }, { text : 'A link', type : 'template', editor : false, template : () => `<a href="https://bryntum.com" target="_blank">Click me</a>` }, { type : 'date', text : 'Time', format : 'HH:mm', field : 'time', width : 80 }, { text : 'Age', field : 'age', width : 60 } ] }, { text : 'Notes', field : 'notes' } ], data : DataGenerator.generateData(20) });

Features

To avoid the Grid core being bloated, its main features are implemented in separate `feature` classes. You can find the Grid features listed in the navigation tree (on the left) under API docs > Grid > feature. You can also find them listed and described in this guide. These can be turned on and off based on your requirements. To configure (or disable) a feature, use the features object to provide your desired configuration for the features you want to use. Each feature has an ´id´ that you use as a key in the features object:
const grid = new Grid({
    features : {
        cellEdit     : false,
        regionResize : true,
        cellTooltip  : {
            tooltipRenderer : (data) => {
            }
        },
        ...
    }
});

Column configuration options

A grid contains a number of columns stored in a ColumnStore that control how your data is rendered. The simplest option is to point a Column to a field in your dataset, or define a custom renderer. The renderer function receives one object parameter containing rendering data for the current cell being rendered.

const grid = new Grid({
    columns: [
        {
            field: 'task',
            text: 'Task',
            renderer(renderData) {
                const record = renderData.record;

if (record.percentDone === 100) { renderData.cellElement.classList.add('taskDone'); renderData.cellElement.style.background = 'green'; }

return renderData.value; } } ] });

You can modify columns programmatically easily:

// resize first column
grid.columns.first.width = 200;

// Change text grid.columns.first.text = 'New text';

To learn more about modifying individual columns, please see the docs for ColumnStore and Column.

Grid sections (aka "locked" or "frozen" columns)

The grid can be divided horizontally into individually scrollable sections. This is great if you have lots of columns that don't fit the available width of the screen. To enable this feature, simply mark the columns you want to lock. Locked columns are then displayed in their own section to the left of the other columns:

const grid = new Grid({
    width    : 500,
    subGridConfigs : {
        // set a fixed locked section width if desired
        locked : { width: 300 }
    },
    columns : [
        { field : 'name', text : 'Name', width : 200, locked : true },
        { field : 'firstName', text : 'First name', width : 100, locked : true },
        { field : 'surName', text : 'Last name', width : 100, locked : true },
        { field : 'city', text : 'City', width : 100 },
        { type : 'number', field : 'age', text : 'Age', width : 200 },
        { field : 'food', text : 'Food', width : 200 }
    ]
});

// Grid with locked columns const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, width : 500, subGridConfigs : { locked : { width : 300 } }, data : DataGenerator.generateData(5), columns : [ { field : 'name', text : 'Name', width : 200, locked : true }, { field : 'firstName', text : 'First name', width : 100, locked : true }, { field : 'surName', text : 'Last name', width : 100, locked : true }, { field : 'city', text : 'City', width : 100 }, { type : 'number', field : 'age', text : 'Age', width : 200 }, { field : 'food', text : 'Food', width : 200 } ] });
You can also move columns between sections by using drag and drop, or use the built-in header context menu. If you want to be able to resize the locked grid section, enable the RegionResize feature.

Filtering

One important requirement of a good Grid component is the ability to filter large datasets to quickly find what you are looking for. To enable filtering (through the context menu), add the Filter feature:

const grid = new Grid({
    features: {
        filter: true
    }
});

Or activate a default filter at initial rendering:

const grid = new Grid({
    features: {
        filter: { property : 'city', value : 'New York' }
    }
});

targetElement.innerHTML = '<p>Click the filter icon on column headers to apply filters</p>'; const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, features : { filter : true }, data : DataGenerator.generateData(5), columns : [ { field : 'name', text : 'Traveller', flex : 1 }, { field : 'city', text : 'Visited', flex : 1 }, { field : 'food', text : 'Ate', flex : 1 }, { field : 'rating', text : 'Score', flex : 1 } ] });

Tooltips

If you have a data models with many fields, and you want to show additional data when hovering over a cell, use the CellTooltip feature. To show a tooltip for all cells:

const grid = new Grid({
    features: {
        cellTooltip: ({value}) => value
    }
});

targetElement.innerHTML = '<p>Hover a cell to show the cell tooltip, note the Score loads async content</p>'; const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, features : { // enable CellTooltip and configure a default renderer cellTooltip : { tooltipRenderer : ({ record, column }) => record[column.field], hoverDelay : 200 } }, data : DataGenerator.generateData(5), columns : [ // basic columns has a TextField as editor by default { field : 'name', text : 'Name', flex : 1 }, // a custom editor can be specified { field : 'city', text : 'City', flex : 1, editor : { type : 'combo', items : ['Stockholm', 'New York', 'Montreal'] } }, // tooltipRenderer can return a Promise for async tooltip content { field : 'score', text : 'Score (Async tooltip)', flex : 1, tooltipRenderer : ({ record }) => new Promise(resolve => { setTimeout(() => { resolve(record.name + ': Some remote content'); }, 2000); }) }, // Or use the async notation in the tooltipRenderer { type : 'number', field : 'age', text : 'Age (readonly)', flex : 1, editor : false//, // tooltipRenderer : async ({ record }) => { // const result = await AjaxHelper.load('myPath'); // // return result.text(); // } } ] });

Inline Editing (default on)

To enable inline cell editing in the grid, simply add the CellEdit feature:

const grid = new Grid({
    features : {
        cellEdit : true
    },
    columns: [
        {
            field: 'task',
            text: 'Task'
        }
    ]
});

// grid with cell editing const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, features : { // cellEditing is enabled by default, so this is not necessary cellEdit : true }, data : DataGenerator.generateData(5), columns : [ // basic columns has a TextField as editor by default { field : 'name', text : 'Name', flex : 1, // Invoked on final edit of input field, typically after pressing enter or blurring the field. finalizeCellEdit : ({ value }) => { // returning true will accept the new value otherwise it shows the return statement as error message return value.trim().length < 5 ? 'Name should be at least 5 characters' : true; } }, // a custom editor can be specified { field : 'city', text : 'City', flex : 1, editor : { type : 'combo', items : ['Stockholm', 'New York', 'Montreal'] } }, // column types may specify an editor // NumberColumn for example uses a NumberField { type : 'number', field : 'score', text : 'Score', flex : 1, finalizeCellEdit : ({ value, record }) => { // record contains sibling column's data const { city } = record; // Perform validation based on a sibling column if (city == 'Paris' && value > 999) { return "Score can't be higher than 999 for Paris"; } return true; } }, // specify editor: false to make a column "readonly" { type : 'number', field : 'age', text : 'Age (readonly)', flex : 1, editor : false } ] });

Context Menu

Use CellMenu and HeaderMenu features if you want your users to be able to interact with the data through the context menu:

const grid = new Grid({
    features : {
        headerMenu : {
            items : {
                showInfo : {
                    text   : 'Show info',
                    icon   : 'fa fa-info-circle',
                    weight : 200,
                    onItem : ({ item }) => console.log(item.text)
                }
            }
        },
        cellMenu :  {
            items : {
                showOptions : {
                    text   : 'Show options',
                    icon   : 'fa fa-gear',
                    weight : 200
                }
            }
        }
    }
});

// grid with ContextMenu feature const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, features : { // this feature is enabled by default, // so no need for this unless you have changed defaults cellMenu : true }, data : DataGenerator.generateData(5), columns : [ { field : 'name', text : 'Name', flex : 1 }, { field : 'score', text : 'Score', flex : 1 }, { type : 'action', actions : [ { cls : 'fa fa-ellipsis-h', onClick({ record, target, column, grid }) { grid.features.cellMenu.showMenuFor({ record, column }, { targetElement : target }); } } ] } ] });

Grouping

To group rows by a field in your dataset, use the Group feature.
const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, features : { // group by food group : 'food' }, data : DataGenerator.generateData(5), columns : [ { field : 'name', text : 'Name', flex : 1 }, { field : 'food', text : 'Favorite food', flex : 1 }, { field : 'city', text : 'City', flex : 1 } ] });

Searching

When working with lots of data, a quick alternative to filtering is the Search feature. It highlights matching values in the grid as you type.
targetElement.innerHTML = '<p>Type in the field below to search in the grid</p>'; const searchField = new TextField({ appendTo : targetElement, label : 'Search', icon : 'b-icon b-icon-search', style : 'margin-bottom: 1em', onInput : () => grid.features.search.search(searchField.value) }); // grid with Search feature const grid = new Grid({ appendTo : targetElement, // makes grid as high as it needs to be to fit rows autoHeight : true, features : { // enable searching search : true }, data : DataGenerator.generateData(5), columns : [ { field : 'name', text : 'Name', flex : 1 }, { field : 'city', text : 'City', flex : 1 } ] });

Loading and saving data

The grid keeps all its data in a Store, which is essentially an Array of Model items. You define your own Model representing your data entities and use the Model API to get and set values.

class Person extends Model {}

const person = new Person({ name: 'Steve', age: 38 });

person.name = 'Linda'; // person object is now `dirty`

const store = new Store({ data : [ { name : 'Don', age : 40 } ] });

store.add(person);

console.log(store.count); // === 2

store.remove(person); // Remove from store

When you update a record in a store, it's considered dirty, until you call commit on the containing Store. You can also configure your Store to commit automatically (like Google docs). If you use an AjaxStore, it will send changes to your server when commit is called.

Any changes you make to the Store or its records are immediately reflected in the Grid, so there is no need to tell it to refresh manually.

To create a custom load mask, subscribe to the grid's store events and mask on beforeRequest and unmask on afterRequest. The mask can also be used to display error messages if an exception occurs.

 const grid = new Grid({
     loadMask : null
 });

grid.store.on({ beforeRequest() { grid.masked = { text : 'Data is loading...' }; }, afterRequest() { grid.masked = null; }, exception({ response }) { grid.masked.error = response.message || 'Load failed'; } });

store.load();

To learn more about loading and saving data, please refer to this guide.

Lazy loading (infinite scroll)

Enabling lazy loading of Grid records makes it possible to load the dataset in chunks when records are scrolled into view, instead of loading the complete dataset at once.

Set the lazyLoad config on the Store to true to enable this behaviour. You will also need something that initiates the first load, either use autoLoad or call the load function manually.

Using an AjaxStore

new Grid({
    store: {
        // This will create an AjaxStore
        readUrl: 'backend/read',
        // This will activate the lazy load functionality
        lazyLoad: true,
        // This will load the Store initially upon creation
        autoLoad: true
    }
});

Using a regular Store

class MyStore extends Store {
    static configurable = {
        lazyLoad: true,
        autoLoad: true
    };

async requestData({ startIndex, count }) { const response = await fetchData({ startIndex, count });

// The requestData function is expected to return an object // with a data property, whose value contains all the records return { data: response.data, // And optionally, but recommended, is to provide a total // count of all available records total: response.totalCount } } }

new Grid({ store: new MyStore() });

Please note that, when using a lazy loaded Store, there is a number of Grid features, functions and configs that are either not supported at all or only works in a limited way. Such information is available in the corresponding documentation.

There is also a guide on how to use lazy loading in your Grid's store.

Default configs

There is a myriad of configs and features available for Grid, some of them on by default and some of them requiring extra configuration. The code below tries to illustrate the major things that are used by default:

const grid = new Grid({
   // The following features are enabled by default:
   features : {
       cellEdit      : true,
       columnPicker  : true,
       columnReorder : true,
       columnResize  : true,
       cellMenu      : true,
       headerMenu    : true,
       group         : true,
       rowCopyPaste  : true, // Allow using [Ctrl/CMD + C/X] and [Ctrl/CMD + V] to copy/cut and paste rows
       sort          : true
   },

autoHeight : false, // Grid needs to have a height supplied through CSS (strongly recommended) or by specifying `height` columnLines : true, // Themes might override it to hide lines anyway emptyText : 'No rows to display', enableTextSelection : false, // Not allowed to select text in cells by default, fillLastColumn : true, // By default the last column is stretched to fill the grid fullRowRefresh : true, // Refreshes entire row when a cell value changes loadMask : 'Loading...', resizeToFitIncludesHeader : true, // Also measure header when auto resizing columns responsiveLevels : { small : 400, medium : 600, large : '*' }, rowHeight : null, // Determined using CSS, it will measure rowHeight showDirty : false, // No indicator for changed cells });

Keyboard shortcuts

Grid has the following default keyboard shortcuts:

Keys Action Weight ¹ Action description
ArrowUp navigateUp 10 Focuses the cell above currently focused cell.
ArrowRight navigateRight 10 Focuses the cell to the right of currently focused cell
ArrowDown navigateDown 10 Focuses the cell below currently focused cell
ArrowLeft navigateLeft 10 Focuses the cell to the left of currently focused cell
Shift+ArrowUp extendSelectionUp Extends the selection one row up from currently focused cell
Shift+ArrowRight extendSelectionRight Extends the selection one column to the right from currently focused cell
Shift+ArrowDown extendSelectionDown Extends the selection one row down from currently focused cell
Shift+ArrowLeft extendSelectionLeft Extends the selection one column to the left from currently focused cell
Space toggleSelection 10 Toggles selection of currently focused cell if selectionMode.selectOnKeyboardNavigation is false
injects contextmenu event into the cell.
Ctrl+Home navigateFirstCell Focuses the first cell at the first row (including header)
Home navigateFirstColumn Focuses the first cell of current focused row
Ctrl+End navigateLastCell Focuses the last cell of the last row
End navigateLastColumn Focuses the last cell of current focused row
PageUp navigatePrevPage Displays previous page
PageDown navigateNextPage Displays next page
Enter activateCell Clicks header when focused on a header. Activates the cell if cell element focused.
Activation means activating cell editing or focusing the first focusable element in the cell.
Escape deactivateCell Deactivates cell when focus is inside the cell. Cancels cell editing. Focuses cell element
F2 toggleCellActivate Toggles cell activation. Enters and exits cell editing or focuses into and out of the cell.
Ctrl+Z undoRedoKeyPress Undo/redo (when using StateTrackingManager)
Ctrl+Shift+Z undoRedoKeyPress Undo/redo (when using StateTrackingManager)

¹ Customization of keyboard shortcuts that has a weight can affect other features that also uses that particular keyboard shortcut. Read more in our guide.

Please note that Ctrl is the equivalent to Command and Alt is the equivalent to Option for Mac users

The following Grid features has their own keyboard shortcuts. Follow the links for details.

For more information on how to customize keyboard shortcuts, please see our guide

Performance

In general the Grid widget has very good performance and you can try loading any amount of data in the bigdataset demo. The overall rendering performance is naturally affected by many other things than the data volume. Other important factors that can impact performance: number of columns, complex cell renderers, locked columns, the number of features enabled and of course the browser (Chrome fastest).

Accessibility

As far as possible, the grid is accessible to WAI-ARIA standards. Every cell, including column header cells is visitable. The arrow keys navigate, and if a cell contains focusable content, navigating to that cell focuses the content. Escape will exit from that and focus the encapsulating cell.

When tabbing back into a grid that has previously been entered, focus moves to the last focused cell.

The column menu is invoked using the Space key when focused on a column header.

The cell menu is invoked using the Space key when focused on a data cell.

Saving state

The grid supports saving its UI state to ensure end users will see the same column sizes, sorting, grouping settings as they reload the page / app. Please refer to the GridState and State documentation for more information on state management.

Useful configs and functions

Member Description
columns Array of column definitions
store Data store supplying rows
data Inline data array (creates a store automatically)
features Object to enable/configure grid features
selectionMode Configures row/cell/checkbox selection behavior
rowHeight Height of each row in pixels
readOnly Set to true to disallow editing
scrollRowIntoView Scrolls a row into the visible area

See also

  • TreeGrid - Tree variant of the grid
  • SubGrid - The scrollable sections within a grid
  • Column - Base column class
  • ColumnStore - Store managing column definitions
  • Store - Data store for grid rows
No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Preserve the grid's vertical scroll position when changesets are applied, as in the case of remote changes, or when stores are configured with syncDataOnLoad.

    Has a corresponding runtime preserveScroll property.

  • Set true to add a border to this container's element.

  • Custom style spec to add to element

    Has a corresponding runtime style property.

  • Update fields if the record changes

  • Can be set to true to make a focus of a focusable encapsulating element relay focus down into a focusable child. This is normally false to allow mousedown to begin text selection in Popups.

  • Number of columns to use in a grid layout. Applied as grid-template-columns: repeat(n, auto). Also applies the b-columns CSS class to the container.

    Has a corresponding runtime gridColumns property.

  • isolateFields : Booleanfalse
    internal
    Panel

    Specify true to isolate record changes to this container and its ancestors. Prevents record updates from propagating up from here and also prevents record updates from parent from propagating down to us.

  • The tools to add either before or after the title in the Panel header. Each property name is the reference by which an instantiated tool may be retrieved from the live tools property.

    Has a corresponding runtime tools property.

  • Element (or the id of an element) to append this widget's element to. Can be configured, or set once at runtime. To access the element of a rendered widget, see element.

    Has a corresponding runtime appendTo property.

  • Object to apply to elements dataset (each key will be used as a data-attribute on the element)

    Has a corresponding runtime dataset property.

  • A createElement config object or HTML string from which to create the Widget's element.

    Has a corresponding runtime element property.

  • Widget id, if not specified one will be generated. Also used for lookups through Widget.getById

    Has a corresponding runtime id property.

  • Element (or element id) to insert this widget before. If provided, appendTo config is ignored.

    Has a corresponding runtime insertBefore property.

  • Element (or element id) to append this widget element to, as a first child. If provided, appendTo config is ignored.

    Has a corresponding runtime insertFirst property.

  • Internal listeners, that cannot be removed by the user.

  • Configure UI transitions for various actions in the grid.

    • insertRecord : Boolean

      Transition record insertions

    • removeRecord : Boolean

      Transition record removals

    • toggleColumn : Boolean

      Transition column visibility changes

    • expandCollapseColumn : Boolean

      Transition parent/group column expand/collapse

    • toggleRegion : Boolean

      Transition region expand/collapse

    • toggleTreeNode : Boolean

      Transition tree node expand/collapse

    • toggleGroup : Boolean

      Transition group expand/collapse

    • filterRemoval : Booleanfalse

      Transition row removals caused by filtering (under specific conditions)

    Has a corresponding runtime transition property.

  • When this widget is a child of a Container, it will by default be participating in a flexbox layout. This config allows you to set this widget's align-self style.

    Has a corresponding runtime alignSelf property.

  • Automatically set grids height to fit all rows (no scrolling in the grid). In general you should avoid using autoHeight: true, since it will bypass Grids virtual rendering and render all rows at once, which in a larger grid is really bad for performance.

  • Controls whether the panel is collapsed (the body of the panel is hidden while only the header is visible). Only valid if the panel is collapsible.

    Has a corresponding runtime collapsed property.

  • Set to true to stretch the last column in a grid with all fixed width columns to fill extra available space if the grid's width is wider than the sum of all configured column widths.

  • When this widget is a child of a Container, it will by default be participating in a flexbox layout. This config allows you to set this widget's flex style. This may be configured as a single number or a <flex-grow> <flex-shrink> <flex-basis> format string. numeric-only values are interpreted as the flex-grow value.

    Has a corresponding runtime flex property.

  • Widget's height, used to set element style.height. Either specify a valid height string or a number, which will get 'px' appended. We recommend using CSS as the primary way to control height, but in some cases this config is convenient.

    Has a corresponding runtime height property.

  • Configure with true to make widget initially hidden.

    Has a corresponding runtime hidden property.

  • Widget's margin. This may be configured as a single number or a TRBL format string. numeric-only values are interpreted as pixels.

    Has a corresponding runtime margin property.

  • The element's maxHeight. Can be either a String or a Number (which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels.

    Has a corresponding runtime maxHeight property.

  • The elements maxWidth. Can be either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.

    Has a corresponding runtime maxWidth property.

  • The elements minWidth. Can be either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.

    Has a corresponding runtime minWidth property.

  • Set to false to only measure cell contents when double-clicking the edge between column headers.

  • A widgets weight determines its position among siblings when added to a Container. Higher weights go further down.

  • Widget's width, used to set element style.width. Either specify a valid width string or a number, which will get 'px' appended. We recommend using CSS as the primary way to control width, but in some cases this config is convenient.

    Has a corresponding runtime width property.

  • A Mask config object, or a message to be shown when a store is performing a remote operation, or Crud Manager is loading data from the sever. Set to null to disable default load mask.

  • Deprecated:

    7.0.0 Deprecated animateFilterRemovals. Use transition.filterRemoval instead

    Set to true to animate row removals caused by filtering.

  • Deprecated:

    7.0.0 Deprecated animateRemovingRows. Use transition.removeRecord instead

    Controls if removing and inserting rows should be animated. Set to false to prevent those animations, removing the related delays.

  • Set to false to crop text in grid cells without ellipsis (...). When enabled, cells containing pure use display : block, instead of display : flex to allow ellipsis to work. NOTE Only supported in browsers that support :has() CSS selector

    Has a corresponding runtime cellEllipsis property.

  • Set to false to not show column lines. End result might be overruled by/differ between themes.

    Has a corresponding runtime columnLines property.

  • contextMenuTriggerEvent : 'contextmenu'/'click'/'dblclick'contextmenu
    GridBase

    Event which is used to show context menus. Available options are: 'contextmenu', 'click', 'dblclick'.

  • When this Widget configuration is used in the Grid's RowExpander feature's widget config, provide the field on the expanded record to use for populating this widget's store (if applicable)

  • Region to which columns are added when they have none specified

  • Set to true to destroy the store when the grid is destroyed.

  • Set to true to not get a warning when using another base class than GridRowModel for your grid data. If you do, and would like to use the full feature set of the grid then include the fields from GridRowModel in your model definition.

  • Deprecated:

    7.3.0 Use features : { stickyCells : true } instead

    Set to true to enable the StickyCells feature, which pins cell content to the top of the grid while rows scroll off the top but remain visible.

  • Set to true to listen for CTRL-Z (CMD-Z on Mac OS) keyboard event and trigger undo (redo when SHIFT is pressed). Only applicable when using a StateTrackingManager.

    Has a corresponding runtime enableUndoRedoKeys property.

  • Set to true to hide the footer elements

    Has a corresponding runtime hideFooters property.

  • Set to true to hide the column header elements

    Has a corresponding runtime hideHeaders property.

  • Set to true to hide the Grid's horizontal scrollbar(s)

  • A CSS class to add to hovered row elements

  • An icon to show before the title. Either pass a CSS class as a string, or pass a DomConfig object describing an element to represent the icon.

  • Set to false to disable localization of this object.

  • Time in ms until a longpress is triggered

    Has a corresponding runtime longPressTime property.

  • Grids change the maskDefaults to cover only their body element.

  • Set to true to apply the default mask to the widget. Alternatively, this can be the mask message or a Mask config object.

  • Grid monitors window resize by default.

  • Specify plugins (an array of classes) in config

    Has a corresponding runtime plugins property.

  • True to preserve focused cell after loading new data

  • Specify true to preserve vertical scroll position after store actions that trigger a refresh event, such as loading new data and filtering.

  • Prevent tooltip from being displayed on touch devices. Useful for example for buttons that display a menu on click etc, since the tooltip would be displayed at the same time.

  • If you are rendering this widget to a shadow root inside a web component, set this config to the shadowRoot. If not inside a web component, set it to document.body

  • Set to false to not show row lines. End result might be overruled by/differ between themes.

    Has a corresponding runtime rowLines property.

  • Animation transition duration in milliseconds.

    Has a corresponding runtime transitionDuration property.

  • This config is used with PanelCollapserOverlay to programmatically control the visibility of the panel's body. In this mode of collapse, the body of a collapsed panel is a floating overlay. Setting this config to true will show this element, while false will hide it.

  • Configuration values for the ScrollManager class on initialization. Returns the ScrollManager at runtime.

    Has a corresponding runtime scrollManager property.

  • The class to instantiate to use as the scrollable. Defaults to Scroller.

  • Set to true to allow text selection in the grid cells. Note, this cannot be used simultaneously with the RowReorder feature.

  • Set to true to not get a warning when calling getState when there is a column configured without an id. But the recommended action is to always configure columns with an id when using states.

  • Deprecated:

    7.0.0 Deprecated animateTreeNodeToggle. Use transition.toggleTreeNode instead

    When the Tree feature is in use and the Store is a tree store, this config may be set to true to visually animate branch node expand and collapse operations.

    This is not supported in Scheduler and Gantt

    Has a corresponding runtime animateTreeNodeToggle property.

  • The bottom CSS absolute position for this widget. If specified, the widget is implicitly configured as positionable.

  • Programmatic control over which column to start in when used in a grid layout.

    Has a corresponding runtime column property.

  • left : Number/String
    internal
    Panel

    The inset-inline-start CSS absolute position for this widget. If specified, the widget is implicitly configured as positionable.

  • Set this config to false to disable batching DOM updates on animation frames for this widget. This has the effect of synchronously updating the DOM when configs affecting the rendered DOM are modified. Depending on the situation, this could simplify code while increasing time spent updating the DOM.

  • The inset-inline-end CSS absolute position for this widget. If specified, the widget is implicitly configured as positionable.

  • Programmatic control over how many columns to span when used in a grid layout.

    Has a corresponding runtime span property.

  • top : Number/String
    internal
    Panel

    The top CSS absolute position for this widget. If specified, the widget is implicitly configured as positionable.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isDelayable : Booleantrue
    READONLY
    static
    ADVANCED
    Delayable
    Identifies an object as an instance of Delayable class, or subclass thereof.
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isGrid : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of Grid class, or subclass thereof.
  • isGridElementEvents : Booleantrue
    READONLY
    static
    ADVANCED
    GridElementEvents
    Identifies an object as an instance of GridElementEvents class, or subclass thereof.
  • isGridFeatures : Booleantrue
    READONLY
    static
    ADVANCED
    GridFeatures
    Identifies an object as an instance of GridFeatures class, or subclass thereof.
  • isGridResponsive : Booleantrue
    READONLY
    static
    ADVANCED
    GridResponsive
    Identifies an object as an instance of GridResponsive class, or subclass thereof.
  • isGridSelection : Booleantrue
    READONLY
    static
    ADVANCED
    GridSelection
    Identifies an object as an instance of GridSelection class, or subclass thereof.
  • isGridState : Booleantrue
    READONLY
    static
    ADVANCED
    GridState
    Identifies an object as an instance of GridState class, or subclass thereof.
  • isGridSubGrids : Booleantrue
    READONLY
    static
    ADVANCED
    GridSubGrids
    Identifies an object as an instance of GridSubGrids class, or subclass thereof.
  • isKeyMap : Booleantrue
    READONLY
    static
    ADVANCED
    KeyMap
    Identifies an object as an instance of KeyMap class, or subclass thereof.
  • isLoadMaskable : Booleantrue
    READONLY
    static
    ADVANCED
    LoadMaskable
    Identifies an object as an instance of LoadMaskable class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isPluggable : Booleantrue
    READONLY
    static
    ADVANCED
    Pluggable
    Identifies an object as an instance of Pluggable class, or subclass thereof.
  • isRTL : Booleantrue
    READONLY
    static
    ADVANCED
    RTL
    Identifies an object as an instance of RTL class, or subclass thereof.
  • isState : Booleantrue
    READONLY
    static
    ADVANCED
    State
    Identifies an object as an instance of State class, or subclass thereof.
  • isToolable : Booleantrue
    READONLY
    static
    ADVANCED
    Toolable
    Identifies an object as an instance of Toolable class, or subclass thereof.
  • properties : Object
    internal
    static
    Panel

    A class property getter for the default values of internal properties for this class.

  • all : Widget[]
    internal
    READONLY
    static
    Panel

    Returns an array containing all existing Widgets. The returned array is generated by this call and is not an internal structure.

  • focusVisible : Boolean
    internal
    READONLY
    static
    Panel

    This property yields true if the currently focused element has been reached through other means than mouse click. If the activeElement matches :focus-visible.

  • recomposeAsync : Boolean
    internal
    static
    Panel

    Get/set the recomposeAsync config for all widgets. Setting this value will set the config for all existing widgets and will be the default value for newly created widgets. Set this value to null to disable the default setting for new widgets while leaving existing widgets unaffected.

    Has a corresponding recomposeAsync config.

  • tooltip : Tooltip
    READONLY
    static
    Panel

    The shared Tooltip instance which handles tooltips which are not configured with newInstance : true.

  • Preserve the grid's vertical scroll position when changesets are applied, as in the case of remote changes, or when stores are configured with syncDataOnLoad.

    Has a corresponding preserveScroll config.

  • subGrids : Object<String, SubGrid>
    READONLY
    GridSubGrids

    An object containing the SubGrid region instances, indexed by subGrid id ('locked', normal'...)

  • emptyArray : Array
    internal
    READONLY
    Panel

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    Panel

    An empty object that can be used as a default value.

  • isContainer : Booleantrue
    READONLY
    ADVANCED
    Panel
    Identifies an object as an instance of Container class, or subclass thereof.
  • isGrid : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of Grid class, or subclass thereof.
  • isGridBase : Booleantrue
    READONLY
    ADVANCED
    GridBase
    Identifies an object as an instance of GridBase class, or subclass thereof.
  • isPanel : Booleantrue
    READONLY
    ADVANCED
    Panel
    Identifies an object as an instance of Panel class, or subclass thereof.
  • isWidget : Booleantrue
    READONLY
    ADVANCED
    Panel
    Identifies an object as an instance of Widget class, or subclass thereof.
  • Number of columns to use in a grid layout. Applied as grid-template-columns: repeat(n, auto). Also applies the b-columns CSS class to the container.

    Has a corresponding gridColumns config.

  • initialItems : Boolean
    internal
    READONLY
    Panel

    This property is true until the container's initial items config has been processed. This property is set to false by the updateItems method.

  • bbar : Toolbar
    READONLY
    Panel

    Get toolbar Toolbar docked to the bottom of the panel

    Has a corresponding bbar config.

  • tbar : Toolbar
    READONLY
    Panel

    Get toolbar Toolbar docked to the top of the panel

    Has a corresponding tbar config.

  • The tools as specified by the tools configuration. Each is a Tool instance which may be hidden, shown and observed and styled just like any other widget.

    Has a corresponding tools config.

  • Element (or the id of an element) to append this widget's element to. Can be configured, or set once at runtime. To access the element of a rendered widget, see element.

    Has a corresponding appendTo config.

  • contentElement : HTMLElement
    READONLY
    ADVANCED
    Panel

    The child element into which content should be placed. This means where html should be put, or, for Containers, where child items should be rendered.

  • Get widgets elements dataset or assign to it

    Has a corresponding dataset config.

  • Get this widget's encapsulating HTMLElement, which is created along with the widget but added to DOM at render time.

    Has a corresponding element config.

  • focusElement : HTMLElement
    READONLY
    ADVANCED
    Panel

    Get this widget's primary focus holding element if this widget is itself focusable, or contains focusable widgets.

  • focusability : Focusability
    internal
    READONLY
    Panel

    Returns an object describing the focus and keyboard navigation aspects of this widget's focusElement.

  • focusableElement : HTMLElement
    READONLY
    ADVANCED
    Panel

    Returns this widget's focusElement if that element can currently be given focus (e.g., this widget is not disabled, or hidden).

  • hasPainted : Boolean
    internal
    READONLY
    Panel

    This property is set to true after processing the initial paint for the widget. It remains false during the initial paint. The intended use for this flag is to avoid processing that will be handled by the first paint (similar to not firing events during the widget's initial configuration). If this field is true, the initial paint has already taken place, otherwise, it has yet to run. This field differs from isPainted which checks that the widget's element is attached to the DOM.

  • Get/set widgets id

    Has a corresponding id config.

  • Element (or element id) to insert this widget before. If provided, appendTo config is ignored.

    Has a corresponding insertBefore config.

  • Element (or element id) to append this widget element to, as a first child. If provided, appendTo config is ignored.

    Has a corresponding insertFirst config.

  • overflowElement : HTMLElement
    READONLY
    ADVANCED
    Panel

    The child element which scrolls if any. This means the element used by the scrollable.

  • staticClassList : DomClassList
    internal
    READONLY
    Panel

    Returns the DomClassList for this widget's class. This object should not be mutated.

  • Get/set widgets elements style. The setter accepts a cssText string or a style config object, the getter always returns a CSSStyleDeclaration

    Has a corresponding style config.

  • contentHeight : Number
    private
    READONLY
    GridBase

    Returns content height calculated from row manager

  • keyMapElement : HTMLElement
    private
    READONLY
    KeyMap

    Override to attach the keyMap keydown event listener to something else than this.element

  • keyMapSubComponents : Object
    private
    READONLY
    KeyMap

    Override to make keyMap resolve subcomponent actions to something else than this.features.

  • Get/set this widget's align-self flexbox setting. This may be set to modify how this widget is aligned within the cross axis of a flexbox layout container.

    Has a corresponding alignSelf config.

  • Body height

  • Controls whether the panel is collapsed (the body of the panel is hidden while only the header is visible). Only valid if the panel is collapsible.

    Has a corresponding collapsed config.

  • This property is true if the panel is currently collapsing.

  • collapsingExpanding : Boolean
    internal
    READONLY
    Panel

    This property is true if the panel is currently either collapsing or expanding.

  • This property is true if the panel is currently expanding.

  • Footer height

  • Header height

  • Get element's offsetHeight or sets its style.height, or specified height if element no created yet.

    Has a corresponding height config.

  • Get element's margin property. This may be configured as a single number or a TRBL format string. numeric-only values are interpreted as pixels.

    Has a corresponding margin config.

  • Get/set element's maxHeight. Getter returns max-height from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels.

    Has a corresponding maxHeight config.

  • Get/set elements maxWidth. Getter returns max-width from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.

    Has a corresponding maxWidth config.

  • Get/set element's minHeight. Getter returns min-height from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like height, reading the value will return the numeric value in pixels.

    Has a corresponding minHeight config.

  • Get/set elements minWidth. Getter returns min-width from elements style, which is always a string. Setter accepts either a String or a Number (which will have 'px' appended). Note that like width, reading the value will return the numeric value in pixels.

    Has a corresponding minWidth config.

  • Accessor to the Scroller which can be used to both set and read scroll information.

    Has a corresponding scrollable config.

  • Get elements offsetWidth or sets its style.width, or specified width if element not created yet.

    Has a corresponding width config.

  • config : Object
    READONLY
    ADVANCED
    Panel

    Returns a copy of the full configuration which was used to configure this object.

  • isConstructing : Boolean
    READONLY
    ADVANCED
    Panel

    This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    Panel

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • assignedId : String
    private
    READONLY
    Panel

    Get id assigned by user (not generated id)

  • Set to false to crop text in grid cells without ellipsis (...). When enabled, cells containing pure use display : block, instead of display : flex to allow ellipsis to work. NOTE Only supported in browsers that support :has() CSS selector

    Has a corresponding cellEllipsis config.

  • Set to false to not show column lines. End result might be overruled by/differ between themes.

    Has a corresponding columnLines config.

  • Get/set element's disabled state. Set to 'inert' to also set the inert DOM attribute.

    Has a corresponding disabled config.

  • Set to true to listen for CTRL-Z (CMD-Z on Mac OS) keyboard event and trigger undo (redo when SHIFT is pressed). Only applicable when using a StateTrackingManager.

    Has a corresponding enableUndoRedoKeys config.

  • true if no id was set, will use generated id instead (widget1, ...). Toggle automatically on creation

  • Set to true to hide the footer elements

    Has a corresponding hideFooters config.

  • Set to true to hide the column header elements

    Has a corresponding hideHeaders config.

  • The currently hovered grid cell

  • This readonly property is true for normal widgets in the items of a container. It is false for special widgets such as a tbar.

  • Get the global LocaleHelper

  • Get the global LocaleManager

  • Time in ms until a longpress is triggered

    Has a corresponding longPressTime config.

  • plugins : Object<String, InstancePlugin>
    READONLY
    ADVANCED
    Pluggable

    Map of applied plugins

    Has a corresponding plugins config.

  • Get currently used responsive level (as string)

  • Set to false to not show row lines. End result might be overruled by/differ between themes.

    Has a corresponding rowLines config.

  • tab : Tab
    READONLY
    Panel

    The tab created for this widget when it is placed in a TabPanel.

    Has a corresponding tab config.

  • Animation transition duration in milliseconds.

    Has a corresponding transitionDuration config.

  • bottomRow : Row
    private
    READONLY
    GridBase

    Get the Row currently displayed furthest down.

  • Get the topmost visible grid row

  • Get the last visible grid row

  • topRow : Row
    private
    READONLY
    GridBase

    Get the Row that is currently displayed at top.

  • Configuration values for the ScrollManager class on initialization. Returns the ScrollManager at runtime.

    Has a corresponding scrollManager config.

  • In cell selection mode, this will get the cell selector for the (last) selected cell. Set to an available cell selector to select only that cell. Or use selectCell() instead.

  • CSS selector for the currently selected cell. Format is "[data-index=index] [data-column-id=column]".

  • In cell selection mode, this will get the cell selectors for all selected cells. Set to an array of available cell selectors. Or use selectCells() instead.

  • The last selected record. Set to select a row or use Grid#selectRow. Set to null to deselect all

  • isStateful : Boolean
    READONLY
    ADVANCED
    State

    Returns true if this instance implements the State interface.

  • isStatefulActive : Boolean
    internal
    READONLY
    State

    Returns true if this instance is ready to participate in state activities.

  • Gets or sets grid's state. Check out GridState mixin for details.

  • Returns the state key to use for this instance. This will be either the stateId or the id (if explicitly specified and stateful is not false).

  • statefulness : Object
    private
    READONLY
    State

    Returns an object whose truthy keys are the config properties to include in this object's state.

  • Deprecated:

    7.0.0 Deprecated animateTreeNodeToggle. Use transition.toggleTreeNode instead

    When the Tree feature is in use and the Store is a tree store, this config may be set to true to visually animate branch node expand and collapse operations.

    This is not supported in Scheduler and Gantt

    Has a corresponding animateTreeNodeToggle config.

  • Determines visibility by checking if the Widget is hidden, or any ancestor is hidden and that it has an element which is visible in the DOM

  • Programmatic control over which column to start in when used in a grid layout.

    Has a corresponding column config.

  • isComposable : Boolean
    internal
    READONLY
    Panel

    Returns true if this class uses compose() to render itself.

  • overflowTwin : Widget
    internal
    READONLY
    Panel

    This widget's twin that is placed in an overflow menu when this widget has been hidden by its owner, typically a Toolbar due to overflow. The overflowTwin is created lazily by ensureOverflowTwin.

  • Programmatic control over how many columns to span when used in a grid layout.

    Has a corresponding span config.

  • Get this Widget's next sibling in the parent Container, or, if not in a Container, the next sibling widget in the same parentElement.

  • Get this Widget's parent when used as a child in a Container,

  • Get this Widget's previous sibling in the parent Container, or, if not in a Container, the previous sibling widget in the same parentElement.

  • widgetMap : Object<String, Widget>
    READONLY
    Panel

    An object which contains a map of descendant widgets keyed by their ref. All descendant widgets will be available in the widgetMap.

Functions

Functions are methods available for calling on the class
  • onClassMixedIn( )
    internal
    static
    Panel

    This optional class method is called when a class is mixed in using the mixin() method.

  • emptyCache( )
    internal
    Panel

    Clear caches, forces all calls to fromCache to requery dom. Called on render/rerender.

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • Init listeners for a bunch of dom events. All events are handled by handleEvent().

  • once( )
    private
    Events

    Internal function used to run a callback function after an event is triggered

  • Removes all listeners registered to this object by the application.

  • Remember scroll position when store is about to apply a changeset

  • Creates a fake subgrid with one row and measures its height. Result is used as rowHeight.

  • Handler for global theme change event (triggered by shared.js). Remeasures row height.

  • Recalculates virtual scrollbars widths and scrollWidth

  • Restore scroll position. Go to the topmost row formerly in the view that is still present in the dataset.

  • Adds extra classes to the Grid element after it's been configured. Also iterates through features, thus ensuring they have been initialized.

  • Used internally to get a range of cell selectors from a start selector to an end selector.

  • collapseAll( )
    FROM-FEATURE
    NON-LAZY-LOAD
    GridBase

    Collapse all groups. This function is exposed on Grid and can thus be called as grid.collapseAll()

    Added by the Group feature, only available when that feature is enabled.

  • expandAll( )
    FROM-FEATURE
    NON-LAZY-LOAD
    GridBase

    Expand all groups. This function is exposed on Grid and can thus be called as grid.expandAll()

    Added by the Group feature, only available when that feature is enabled.

  • Called on keyMapElement keyDown

  • finalizeInit( )
    internal
    Panel

    Called by the Base constructor after all configs have been applied.

  • Find closes bigger level, aka level we want to use.

  • Resumes CSS transitions after a row / event has been updated

  • Hide the load mask.

  • Collapse the panel.

  • Expand the panel.

  • Template method which may be implemented in subclasses to initialize any plugins. This method is empty in the Pluggable base class.

  • Rerenders all grid headers

  • Rerenders the grids rows, headers and footers, completely replacing all row elements with new ones

  • Rerenders all grid rows, completely replacing all row elements with new ones

  • initScroll( )
    private
    GridBase

    Scroll syncing for normal headers & grid + triggers virtual rendering for vertical scroll


    Triggers: scroll

  • Triggered from Grid view when the store changes. This might happen if store events are batched and then resumed. Deselects all records which have been removed.

  • Triggered from Grid view when the id of a record has changed. Update the collection indices.

  • Triggered from Grid view when records get removed from the store. Deselects all records which have been removed.

  • Triggered from Grid view when all records get removed from the store. Deselects all records.

  • selectAll( )
    NON-LAZY-LOAD
    GridSelection

    This selects all rows. If store is filtered, this will merge the selection of all visible rows with any selection made prior to filtering.

  • bindStore( )
    private
    GridBase

    Hooks up data store listeners

  • onStoreAdd( )
    private
    GridBase

    Refreshes rows when data is added to the store

  • Hides load mask after a load request ends either in success or failure

  • Shows a load mask while the connected store is loading

  • Responds to exceptions signalled by the store

  • Rerenders a cell if a record is updated in the store

  • refreshGroups( )
    private
    FROM-FEATURE
    NON-LAZY-LOAD
    GridBase

    Refreshes the store tree grouping by re-applying the current transformation.

    // Refresh groups
    grid.refreshGroups();
    

    Added by the TreeGroup feature, only available when that feature is enabled.

  • afterRecompose( )
    internal
    Panel

    This method is called following an update to the widget's rendered DOM.

  • Disable the widget

  • Enable the widget

  • Unmask the widget

  • fixSizes( )
    private
    GridBase

    Sets widths and heights for headers, rows and other parts of the grid as needed

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code
  • Fired when a FillHandle drag operation is aborted.

    Added by the FillHandle feature, only available when that feature is enabled.

  • recompose
    ADVANCED
    Panel

    This event is fired after a widget's elements have been synchronized due to a direct or indirect call to recompose, if this results in some change to the widget's rendered DOM elements.

  • unsplit
    FROM-FEATURE
    GridBase

    Fires when un-splitting the Grid.

    Added by the Split feature, only available when that feature is enabled.

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
  • Called when a FillHandle drag operation is aborted.

    Added by the FillHandle feature, only available when that feature is enabled.

  • This event is called after a widget's elements have been synchronized due to a direct or indirect call to recompose, if this results in some change to the widget's rendered DOM elements.

  • onUnsplit
    FROM-FEATURE
    GridBase

    Called when un-splitting the Grid.

    Added by the Split feature, only available when that feature is enabled.