SubGrid
A SubGrid is a part of the grid (it has at least one and normally no more than two, called locked and normal). It has its own header, which holds the columns to display rows for in the SubGrid. SubGrids are created by Grid, but you can configure your SubGrids with the subGridConfigs object.
const grid = new Grid({
appendTo : 'container',
features : {
regionResize : true
},
subGridConfigs : {
locked : {
width : 360
},
normal : {
flex : 1
}
}
});
If you use multiple regions in your grid, you can enable the RegionResize feature to let users resize and collapse/expand grid sections.
If not configured with a width or flex, the SubGrid will be sized to fit its columns. In this case, if all columns have a fixed width (not using flex) then toggling columns will also affect the width of the SubGrid.
Useful configs
| Config | Description |
|---|---|
| region | Name of this SubGrid section (e.g. 'locked') |
| columns | Column store for this SubGrid |
| collapsed | Collapse this SubGrid section |
| flex | Flex value for the SubGrid width |
See also
- Grid - The grid that owns SubGrid sections
- subGridConfigs - Configure SubGrids from the grid
- RegionResize - Feature to resize/collapse SubGrid sections
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Column store, a store containing the columns for this SubGrid
-
Region (name) for this SubGrid
-
Set to
falseto prevent this subgrid being resized with the RegionResize feature -
Set
trueto disable moving columns into or out of this SubGrid. -
The subgrid "weight" determines its position among its SubGrid siblings. Higher weights go further right.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of SubGrid class, or subclass thereof.
-
Get/set SubGrid flex, which also sets header and footer flex (if available).
-
Get all row elements for this SubGrid.
-
Get the "viewport" for the SubGrid as a Rectangle
-
Get/set SubGrid width, which also sets header and footer width (if available).
-
Identifies an object as an instance of SubGrid class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
clearRows( )private
Removes all row elements from the subgrids body and empties cache
-
fixWidths( )private
Sets header width and scroller width (if needed, depending on if using flex). Might also change the subgrids width, if it uses a width calculated from its columns.
-
handleHorizontalScroll( )internal
Triggers the 'horizontalScroll' event + makes sure overlay scrollbar is reachable with pointer for a substantial amount of time after scrolling starts
-
initScroll( )private
Init scroll syncing for header and footer (if available).
-
onAddRow( )private
Creates elements for the new rows when RowManager has determined that more rows are needed
-
onInternalResize( )private
Called when grid changes size. SubGrid determines if it has changed size and triggers scroll (for virtual rendering in cells to work when resizing etc.)
-
refreshFakeScroll( )private
Fixes widths of fake scrollers
-
Resize all columns in the SubGrid to fit their width, according to their configured fitMode
-
syncParallelSplitters( )private
Keeps the parallel splitters in the header, footer and fake scroller synced in terms of being collapsed or not.
-
updateHasFlex( )internal
Called when updating column widths to apply 'b-has-flex' which is used when fillLastColumn is configured.