GridBase
A thin base class for Grid. Does not include any features by default, allowing smaller custom-built bundles if used in place of Grid.
NOTE: In most scenarios you probably want to use Grid instead of GridBase.
Configs
157
Configs
157Common
Accepts column definitions for the grid during initialization. They will be used to create Column instances that are added to a ColumnStore.
At runtime it returns the ColumnStore.
Initialization using column config objects:
new Grid({
columns : [
{ text : 'Alias', field : 'alias' },
{ text : 'Superpower', field : 'power' }
]
});
Also accepts a store config object:
new Grid({
columns : {
data : [
{ text : 'Alias', field : 'alias' },
{ text : 'Superpower', field : 'power' }
],
listeners : {
update() {
// Some update happened
}
}
}
});
Access the ColumnStore at runtime to manipulate columns:
grid.columns.add({ field : 'column', text : 'New column' });
Replacing the columns fully at runtime:
grid.columns = [{ field : 'column', text : 'New column' }];
Convenient shortcut to set data in grids store both during initialization and at runtime. Can also be used to retrieve data at runtime, although we do recommend interacting with Grids store instead using the store property.
Setting initial data during initialization:
const grid = new Grid({
data : [
{ id : 1, name : 'Batman' },
{ id : 2, name : 'Robin' },
...
]
});
Setting data at runtime:
grid.data = [
{ id : 3, name : 'Joker' },
...
];
Getting data at runtime:
const records = store.data;
Note that a Store will be created during initialization if none is specified.
Text or HTML, or a EmptyTextDomConfig block to display when there is no data to display in the grid.
When using multiple Grid regions, provide the region property to decide where the text is shown.
By default, it is shown in the first region.
new Grid({
emptyText : {
region : 'locked',
text : 'No data available'
}
})
An object containing Feature configuration objects (or true if no configuration is required)
keyed by the Feature class name in all lowercase.
See Keyboard shortcuts for details
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.
Row height in pixels. This allows the default height for rows to be controlled. Note that it may be overriden by specifying a rowHeight on a per record basis, or from a column renderer.
When initially configured as null, an empty row will be measured and its height will be used as default
row height, enabling it to be controlled using CSS
Store that holds records to display in the grid, or a store config object. If the configuration contains
a readUrl, an AjaxStore will be created.
Note that a store will be created during initialization if none is specified.
Supplying a store config object at initialization time:
const grid = new Grid({
store : {
fields : ['name', 'powers'],
data : [
{ id : 1, name : 'Aquaman', powers : 'Decent swimmer' },
{ id : 2, name : 'Flash', powers : 'Pretty fast' },
]
}
});
Accessing the store at runtime:
grid.store.sort('powers');
Layout
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.
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.
Use fixed row height. Setting this to true will configure the underlying RowManager to use fixed row
height, which sacrifices the ability to use rows with variable height to gain a fraction better
performance.
Using this setting also ignores the getRowHeight function, and thus any row height set in data. Only Grids configured rowHeight is used.
A function called for each row to determine its height. It is passed a record and expected to return the desired height of that records row. If the function returns a falsy value, Grids configured rowHeight is used.
The default implementation of this function returns the row height from the records rowHeight field.
Override this function to take control over how row heights are determined:
new Grid({
getRowHeight(record) {
if (record.low) {
return 20;
}
else if (record.high) {
return 60;
}
// Will use grids configured rowHeight
return null;
}
});
NOTE: Height set in a Column renderer takes precedence over the height returned by this function.
| Parameter | Type | Description |
|---|---|---|
getRowHeight.record | Model | Record to determine row height for |
Desired row height
Grid's min-height. Defaults to 10em to be sure that the Grid always has a height wherever it is
inserted.
Can be either a String or a Number (which will have 'px' appended).
Note that reading the value will return the numeric value in pixels.
Set to false to only measure cell contents when double-clicking the edge between column headers.
Misc
Set to true to animate row removals caused by filtering.
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
Set to false to not show column lines. End result might be overruled by/differ between themes.
Event which is used to show context menus. Available options are: 'contextmenu', 'click', 'dblclick'.
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.
Configure this as true to allow elements within cells to be styled as position: sticky.
Columns which contain sticky content will need to be configured with
cellCls : 'b-sticky-cell',
Or a custom renderer can add the class to the passed cell element.
It is up to the application author how to style the cell content. It is recommended that
a custom renderer create content with CSS class names which the application author
will use to apply the position, and matching margin-top and top styles to keep the
content stuck at the grid's top.
Note that not all browsers support this CSS feature. A cross browser alternative is to use the {link Grid.feature.StickyCells StickyCells} Feature.
Refresh entire row when a record changes (true) or, if possible, only the cells affected (false).
When this is set to false, then if a column uses a renderer, cells in that column will still
be updated because it is impossible to know whether the cells value will be affected.
If a standard, provided Column class is used with no custom renderer, its cells will only be updated if the column's field is changed.
Set to true to hide the column header elements
Set to true to hide the Grid's horizontal scrollbar(s)
Grids change the maskDefaults to cover only their body element.
Grid monitors window resize by default.
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.
Set to true to make the grid read-only, by disabling any UIs for modifying data.
Note that checks MUST always also be applied at the server side.
Set to false to not show row lines. End result might be overruled by/differ between themes.
Configure as true to have the grid show a red "changed" tag in cells whose
field value has changed and not yet been committed.
Set showDirty.duringEdit to true to show the red tag while editing a cell
showDirty : {
duringEdit : true
}
Set showDirty.newRecord to true to show the red tag for all the cells of the
new record
showDirty : {
newRecord : true
}
| Parameter | Type | Description |
|---|---|---|
showDirty.duringEdit | Boolean | Set to |
showDirty.newRecord | Boolean | Set to |
An object containing sub grid configuration objects keyed by a region property.
By default, grid has a 'locked' region (if configured with locked columns) and a 'normal' region.
The 'normal' region defaults to use flex: 1.
This config can be used to reconfigure the "built-in" sub grids or to define your own.
Redefining the default regions:
new Grid({
subGridConfigs : {
locked : { flex : 1 },
normal : { width : 100 }
}
});Defining your own multi region grid:
new Grid({
subGridConfigs : {
left : { width : 100 },
middle : { flex : 1 },
right : { width : 100 }
},
columns : [
{ field : 'manufacturer', text: 'Manufacturer', region : 'left' },
{ field : 'model', text: 'Model', region : 'middle' },
{ field : 'year', text: 'Year', region : 'middle' },
{ field : 'sales', text: 'Sales', region : 'right' }
]
});
Animation transition duration in milliseconds.
Other
An object which names formula prefixes which will be applied to all columns configured with
formula : true.
Each entry is keyed by a formula prefix, and each value is how to instantiate and configure a
FormulaProvider when that prefix is used in the typed vale, eg: =XXX(
If the configured value contains a type property, that is used to determine a registered
formula provider subclass to instantiate.
fields : [{
name : 'review',
formulaProviders : {
AI : {
type : 'remote',
url : 'https://my-ai-service.com'
},
SUM : {
type : 'sum'
}
}
}]
Formula providers may be added to dynamically:
// Enable registered MYFormula class to be used as a formula provider in the Grid
grid.store.modelClass.fieldMap.review.formulaProviders.MY = { ... };
Configure UI transitions for various actions in the grid.
| Parameter | Type | Description |
|---|---|---|
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 | Boolean | Transition row removals caused by filtering (under specific conditions) |
Scrolling
Configures whether the grid is scrollable in the Y axis. This is used to configure a Scroller.
See the scrollerClass config option.
By default the grid is scrollable in the Y axis. If your platform shows scrollbars, they will appear when the content
of the grid overflows.
To always show a scrollbar - even an empty one when there is no overflow - configure this as:
scrollable : {
overflowY : 'scroll'
}
The class to instantiate to use as the scrollable. Defaults to Scroller.
Configuration values for the ScrollManager class on initialization. Returns the ScrollManager at runtime.
Selection
Set to true to allow text selection in the grid cells. Note, this cannot be used simultaneously with the
RowReorder feature.
State
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.
Tree
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.
Content
CSS
DOM
Float & align
Masking
misc
Properties
137
Properties
137Common
Accepts column definitions for the grid during initialization. They will be used to create Column instances that are added to a ColumnStore.
At runtime it returns the ColumnStore.
Initialization using column config objects:
new Grid({
columns : [
{ text : 'Alias', field : 'alias' },
{ text : 'Superpower', field : 'power' }
]
});
Also accepts a store config object:
new Grid({
columns : {
data : [
{ text : 'Alias', field : 'alias' },
{ text : 'Superpower', field : 'power' }
],
listeners : {
update() {
// Some update happened
}
}
}
});
Access the ColumnStore at runtime to manipulate columns:
grid.columns.add({ field : 'column', text : 'New column' });
Replacing the columns fully at runtime:
grid.columns = [{ field : 'column', text : 'New column' }];
Convenient shortcut to set data in grids store both during initialization and at runtime. Can also be used to retrieve data at runtime, although we do recommend interacting with Grids store instead using the store property.
Setting initial data during initialization:
const grid = new Grid({
data : [
{ id : 1, name : 'Batman' },
{ id : 2, name : 'Robin' },
...
]
});
Setting data at runtime:
grid.data = [
{ id : 3, name : 'Joker' },
...
];
Getting data at runtime:
const records = store.data;
Note that a Store will be created during initialization if none is specified.
Text or HTML, or a EmptyTextDomConfig block to display when there is no data to display in the grid.
When using multiple Grid regions, provide the region property to decide where the text is shown.
By default, it is shown in the first region.
new Grid({
emptyText : {
region : 'locked',
text : 'No data available'
}
})
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.
Row height in pixels. This allows the default height for rows to be controlled. Note that it may be overriden by specifying a rowHeight on a per record basis, or from a column renderer.
When initially configured as null, an empty row will be measured and its height will be used as default
row height, enabling it to be controlled using CSS
Store that holds records to display in the grid, or a store config object. If the configuration contains
a readUrl, an AjaxStore will be created.
Note that a store will be created during initialization if none is specified.
Supplying a store config object at initialization time:
const grid = new Grid({
store : {
fields : ['name', 'powers'],
data : [
{ id : 1, name : 'Aquaman', powers : 'Decent swimmer' },
{ id : 2, name : 'Flash', powers : 'Pretty fast' },
]
}
});
Accessing the store at runtime:
grid.store.sort('powers');
Class hierarchy
Layout
Body height
Header height
Misc
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
Set to false to not show column lines. End result might be overruled by/differ between themes.
Set to true to hide the column header elements
Set to true to make the grid read-only, by disabling any UIs for modifying data.
Note that checks MUST always also be applied at the server side.
Set to false to not show row lines. End result might be overruled by/differ between themes.
Animation transition duration in milliseconds.
Other
Configure UI transitions for various actions in the grid.
| Parameter | Type | Description |
|---|---|---|
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 | Boolean | Transition row removals caused by filtering (under specific conditions) |
Rows
Get the topmost visible grid row
Get the last visible grid row
Scrolling
Configuration values for the ScrollManager class on initialization. Returns the ScrollManager at runtime.
Tree
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.
CSS
DOM
Selection
State
Widget hierarchy
Functions
124
Functions
124Getters
Returns a cell if rendered or null if not found.
| Parameter | Type | Description |
|---|---|---|
cellContext | GridLocationConfig | A cell location descriptor |
Searches up from specified element for a grid cell or a header and returns the column which the cell belongs to
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | Element somewhere in a cell |
Column to which the cell belongs
Returns the header element for the column
| Parameter | Type | Description |
|---|---|---|
columnId | String | Number | Column | or Column instance |
Header element
Searches up from the specified element for a grid row and returns the record associated with that row.
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | Element somewhere within a row or the row container element |
Record for the row
Misc
Highlights the specified cells. If scroll is set to true (which it is by default), the highlighted cell
closest to the viewport center will be scrolled into view.
By default, the highlighting will fade out non-highlighted cells. Use the mode option to change the
highlight style to apply a background color to the highlighted cells instead.
// Highlight single cell (default fade mode)
grid.highlightCells({ cells : { id : 1, field : 'name' } });
// Highlight with background color
grid.highlightCells({ cells : { id : 1, field : 'name' }, mode : 'color' });
// Highlight multiple cells
grid.highlightCells({ cells : [{ id : 1, field : 'name' }, { id : 2, field : 'age' }] });
// Don't scroll to highlighted cell, and don't un-highlight on click
grid.highlightCells({ cells : { id : 1, field : 'name' }, scroll : false, unhighlightOnClick : false });
// Auto-unhighlight after 2 seconds
grid.highlightCells({ cells : { id : 1, field : 'name' }, unhighlightAfter : 2000 });
//<code-header>
fiddle.title = 'Cell highlighting';
//</code-header>
const grid = new Grid({
appendTo : targetElement,
autoHeight : true,
data : DataGenerator.generateData(5),
columns : [
{ field : 'name', text : 'Name', flex : 1 },
{ field : 'city', text : 'City', width : 150 },
{ type : 'number', field : 'age', text : 'Age', width : 100 },
{ field : 'food', text : 'Food', width : 150 }
],
tbar : [
{
text : 'Highlight',
rendition : 'outlined',
onClick : ({ source }) => {
source.up('grid').highlightCells({
cells : [
{ id : 1, field : 'city' },
{ id : 5, field : 'food' }
]
});
} },
{
text : 'Highlight (color)',
rendition : 'outlined',
onClick : ({ source }) => {
source.up('grid').highlightCells({
cells : [
{ id : 2, field : 'city' },
{ id : 3, field : 'city' },
{ id : 4, field : 'city' }
],
mode : 'color' });
} },
{
text : 'Highlight (for 2s)',
rendition : 'outlined',
onClick : ({ source }) => {
source.up('grid').highlightCells({
cells : [
{ id : 2, field : 'name' },
{ id : 2, field : 'city' },
{ id : 2, field : 'age' },
{ id : 2, field : 'food' }
],
unhighlightAfter : 2000
});
} }
]
});| Parameter | Type | Description |
|---|---|---|
options | Object | Options config object |
options.cells | GridLocationConfig | GridLocationConfig[] | The cells to highlight. Each cell is specified
as a GridLocationConfig object with |
options.mode | fade | color | The highlight mode:
|
options.scroll | Boolean | BryntumScrollOptions | If |
options.unhighlightOnClick | Boolean | If |
options.unhighlightOthers | Boolean | If |
options.unhighlightAfter | Number | If specified, the cells highlighted by this call will be automatically un-highlighted after the specified number of milliseconds. Cells highlighted by subsequent calls are not affected. |
Show a load mask with a spinner and the specified message. When using an AjaxStore masking and unmasking is handled automatically, but if you are loading data in other ways you can call this function manually when your load starts.
myLoadFunction() {
// Show mask before initiating loading
grid.maskBody('Loading data');
// Your custom loading code
load.then(() => {
// Hide the mask when loading is finished
grid.unmaskBody();
});
}
| Parameter | Type | Description |
|---|---|---|
loadMask | String | MaskConfig | The message to show in the load mask (next to the spinner) or a config object for a Mask. |
Resumes CSS transitions after a row / event has been updated
Runs a function with transitions enabled (row height, event size etc.). Useful if you want to alter the UI state with a transition.
| Parameter | Type | Description |
|---|---|---|
fn | function | The function to run |
A promise which resolves when the transition duration has expired
Suspends CSS transitions after a row / event has been updated
Multiple calls to suspendAnimations stack up, and will require an equal number of resumeAnimations calls to
actually resume animations.
Removes highlighting from the specified cells. If no cells are passed, all highlighted cells will be un-highlighted.
grid.unhighlightCells({ cells : { id : 1, columnId : 'name' } }); // single cell
grid.unhighlightCells({ cells : [{ id : 1, columnId : 'name' }, { id : 2, columnId : 'age' }] }); // multiple cells
grid.unhighlightCells(); // all cells
| Parameter | Type | Description |
|---|---|---|
options | Object | Options config object |
options.cells | GridLocationConfig | GridLocationConfig[] | The cells to un-highlight. Omit this to un-highlight all. |
Hide the load mask.
Rendering
Triggers a render of all the cells in a column.
| Parameter | Type | Description |
|---|---|---|
column | Column | Column[] | |
enableTransitions | Boolean | Set to |
Rerenders all grid headers
Triggers a render of all the cells in the row for the passed record.
Since Grid uses virtualized rows, calling this method for a record that is not currently displayed in a row will not have any effect.
| Parameter | Type | Description |
|---|---|---|
record | Model | The record whose row should be refreshed |
Triggers a render of all the cells in the rows for the passed records. Leave the argument out to refresh all rows.
Since Grid uses virtualized rows, calling this method for records that are not currently displayed in rows will not have any effect.
| Parameter | Type | Description |
|---|---|---|
records | Model[] | The records whose rows should be refreshed |
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
Resumes UI refreshes after updates to the underlying data.
Multiple calls to suspendRefresh stack up, and will require an equal number of resumeRefresh calls to
actually resume UI refresh.
Specify false as the first param to not refresh if this call unblocked the refresh suspension.
| Parameter | Type | Description |
|---|---|---|
trigger | Boolean |
|
Suspends UI refreshes after updates to the underlying data.
Multiple calls to suspendRefresh stack up, and will require an equal number of resumeRefresh calls to
actually resume UI refresh.
Rows
Scrolling
Deactivates automatic scrolling of a subGrid when mouse is moved closed to the edges
| Parameter | Type | Description |
|---|---|---|
subGrid | SubGrid | String | SubGrid[] | String[] | A subGrid instance or its region name or an array of either |
Activates automatic scrolling of a subGrid when mouse is moved closed to the edges. Useful when dragging DOM nodes from outside this grid and dropping on the grid.
| Parameter | Type | Description |
|---|---|---|
subGrid | SubGrid | String | SubGrid[] | String[] | A subGrid instance or its region name or an array of either |
Restore scroll state. If state is not specified, restores the last stored state.
| Parameter | Type | Description |
|---|---|---|
state | Object | Scroll state, optional |
Scrolls a locally available record's cell into view (if it is not already).
| Parameter | Type | Description |
|---|---|---|
cellContext | GridLocationConfig | GridLocation | Cell selector { id: recordId, column: 'columnName' } |
A promise which resolves when the specified cell has been scrolled into view.
Scrolls a column into view (if it is not already)
| Parameter | Type | Description |
|---|---|---|
column | Column | String | Number | Column name (data) or column index or actual column object. |
options | BryntumScrollOptions | How to scroll. |
If the column exists, a promise which is resolved when the column header element has been scrolled into view.
Scrolls a locally available record's row into view. If row isn't rendered it tries to calculate position.
Accepts the BryntumScrollOptions column property
| Parameter | Type | Description |
|---|---|---|
recordOrId | Model | String | Number | Record or record id |
options | GridScrollOptions | How to scroll. |
A promise which resolves when the specified row has been scrolled into view.
Scroll all the way down
A promise which resolves when the bottom is reached.
Scroll all the way up
A promise which resolves when the top is reached.
Stores the scroll state. Returns an objects with a scrollTop number value for the entire grid and a scrollLeft
object containing a left position scroll value per sub grid.
Configuration
Events
Other
Selection
Widget hierarchy
Events
46
Events
46Fires before a row is rendered.
// Adding a listener using the "on" method
gridBase.on('beforeRenderRow', ({ source, row, record, recordIndex }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance. |
row | Row | The row about to be rendered. |
record | Model | The record for the row. |
recordIndex | Number | The zero-based index of the record. |
Grid rows are about to be rendered
// Adding a listener using the "on" method
gridBase.on('beforeRenderRows', ({ source }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | This grid. |
Fired when data in the store changes.
Basically a relayed version of the store's own change event, decorated with a store property.
See the store change event documentation for more information.
// Adding a listener using the "on" method
gridBase.on('dataChange', ({ source, store, action, record, records, changes }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | Owning grid |
store | Store | The originating store |
action | remove | removeAll | add | clearchanges | filter | update | dataset | replace | Name of action which triggered the change. May be one of:
|
record | Model | Changed record, for actions that affects exactly one record ( |
records | Model[] | Changed records, passed for all actions except |
changes | Object | Passed for the |
Fires after a row is rendered.
// Adding a listener using the "on" method
gridBase.on('renderRow', ({ source, row, record, recordIndex }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance. |
row | Row | The row that has been rendered. |
record | Model | The record for the row. |
recordIndex | Number | The zero-based index of the record. |
Grid rows have been rendered
// Adding a listener using the "on" method
gridBase.on('renderRows', ({ source }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | This grid. |
Grid has scrolled vertically
// Adding a listener using the "on" method
gridBase.on('scroll', ({ source, scrollTop }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance. |
scrollTop | Number | The vertical scroll position. |
Fires after a sub grid is collapsed.
// Adding a listener using the "on" method
gridBase.on('subGridCollapse', ({ source, subGrid }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance |
subGrid | SubGrid | The sub grid instance |
Fires after a sub grid is expanded.
// Adding a listener using the "on" method
gridBase.on('subGridExpand', ({ source, subGrid }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance |
subGrid | SubGrid | The sub grid instance |
Event handlers
46
Event handlers
46Called before a row is rendered.
new GridBase({
onBeforeRenderRow({ source, row, record, recordIndex }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance. |
row | Row | The row about to be rendered. |
record | Model | The record for the row. |
recordIndex | Number | The zero-based index of the record. |
Grid rows are about to be rendered
new GridBase({
onBeforeRenderRows({ source }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | This grid. |
Called when data in the store changes.
Basically a relayed version of the store's own change event, decorated with a store property.
See the store change event documentation for more information.
new GridBase({
onDataChange({ source, store, action, record, records, changes }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | Owning grid |
store | Store | The originating store |
action | remove | removeAll | add | clearchanges | filter | update | dataset | replace | Name of action which triggered the change. May be one of:
|
record | Model | Changed record, for actions that affects exactly one record ( |
records | Model[] | Changed records, passed for all actions except |
changes | Object | Passed for the |
Called after a row is rendered.
new GridBase({
onRenderRow({ source, row, record, recordIndex }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance. |
row | Row | The row that has been rendered. |
record | Model | The record for the row. |
recordIndex | Number | The zero-based index of the record. |
Grid rows have been rendered
new GridBase({
onRenderRows({ source }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | This grid. |
Grid has scrolled vertically
new GridBase({
onScroll({ source, scrollTop }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance. |
scrollTop | Number | The vertical scroll position. |
Called after a sub grid is collapsed.
new GridBase({
onSubGridCollapse({ source, subGrid }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance |
subGrid | SubGrid | The sub grid instance |
Called after a sub grid is expanded.
new GridBase({
onSubGridExpand({ source, subGrid }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Grid | The firing Grid instance |
subGrid | SubGrid | The sub grid instance |
Typedefs
15
Typedefs
15Config object that specifies empty text configuration.
| Parameter | Type | Description |
|---|---|---|
region | locked | normal | String | The grid region to add the empty text to |
| Parameter | Type | Description |
|---|---|---|
block | start | end | center | nearest | How far to scroll the element. |
edgeOffset | Number | edgeOffset A margin around the element or rectangle to bring into view. |
animate | AnimateScrollOptions | Boolean | Number | Set to |
highlight | Boolean | function | String | Set to |
focus | Boolean | Set to |
x | Boolean | Pass as |
y | Boolean | Pass as |
maxWidth | Number | How much of the target's width to bring into view if the target is wider. |
maxHeight | Number | How much of the target's height to bring into view if the target is taller. |
column | String | Field name or ID of the column, or the Column instance to scroll to. |
extendTimeAxis | Boolean | Only applies when scrolling an event into view in Scheduler. By default, if the requested event is outside the time axis, the time axis is extended. |
viewport | Rectangle | An optional definition of the scrollable viewport if it has to differ from the actual client area of this Scroller's element. |
Additional options for the preserveScroll configuration.
| Parameter | Type | Description |
|---|---|---|
overscroll | Boolean | When there is not enough content remaining in the viewport to preserve the current scroll position (for example, if rows below have been removed), allow the viewport to temporarily include empty space beyond the available content, in order to avoid scrolling. |
CSS variables
83
CSS variables
83| Name | Description |
|---|---|
--b-grid-column-transition-duration | Transition duration for column operations such as showing, hiding and collapsing |
--b-grid-row-transition-duration | Transition duration for row operations such as adding and removing |
--b-grid-empty-padding | Padding for the message shown when the grid is empty |
--b-grid-empty-color | Text color for the message shown when the grid is empty |
--b-grid-panel-header-padding | Padding for the grid panel header (when having a title or panel tools) |
--b-grid-panel-header-border-bottom | Bottom border for the grid panel header (when having a title or panel tools) |
--b-grid-background | Grid background color |
--b-grid-cell-border-width | Grid cell border width. By default also applies to headers |
--b-grid-cell-gap | Grid cell inner gap |
--b-grid-cell-padding-block | Grid cell padding block. Defaults to 0, since cells are sized programmatically and content is centered vertically |
--b-grid-cell-padding-inline | Grid cell padding inline. By default also applies to headers |
--b-grid-cell-font-size | Grid cell font size |
--b-grid-cell-font-weight | Grid cell font weight |
--b-grid-row-height | Grid's default row height, if not set programmatically or through data |
--b-grid-row-border-width | Grid row border width (bottom border) |
--b-grid-row-zindex | Grid row z-index |
--b-grid-splitter-width | Grid splitter width, when not using the RegionResize feature |
--b-grid-cell-border-color | Grid cell border color |
--b-grid-cell-background | Grid cell background |
--b-grid-cell-color | Grid cell color |
--b-grid-row-border-color | Grid row border color (defaults to use cell border color) |
--b-grid-cell-dirty-color | Grid cell dirty indicator color |
--b-grid-splitter-narrow-color | Grid splitter color, when not using the RegionResize feature |
--b-grid-row-placeholder-color | Row "Skeleton" background color when lazy loading |
--b-grid-cell-highlight-color | Background color for highlighted cells in color mode |
| Focused | |
--b-grid-cell-focused-outline-width | Grid cell focused outline width |
--b-grid-cell-focused-outline-color | Grid cell focused outline color |
| Hovered | |
--b-grid-cell-hover-background | Background for hovered cells |
--b-grid-cell-hover-selected-background | Background for hovered and selected cells |
| Selected | |
--b-grid-cell-selected-color | Grid cell color when selected & hovered |
--b-grid-cell-selected-background | Background for selected cells |