-
-
Notifications
You must be signed in to change notification settings - Fork 29
Pinned (aka Frozen) Columns Rows
- Columns/Rows Pinning Basic
- Rows Pinning starting from Bottom
- Change Pinning Dynamically
- Animated Gif Demo
One of the requested features, columns or rows pinning (aka frozen). You can pin 1 or more Columns and/or 1 or more Rows. Columns can only be pinned starting from the left side, while Rows can be pinned starting from the Top (default) or Bottom. You can also change the pinning dynamically with setOptions()
.
To set a pinning for the entire duration of the grid, simply use the Grid Options frozenColumn
(starting from top) and frozenRow
(starting from left), which are both number
types.
export class GridBasicComponent {
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
attached(): void {
// your columns definition
this.columnDefinitions = [];
this.gridOptions = {
alwaysShowVerticalScroll: false, // disable scroll since we don't want it to show on the left pinned columns
frozenColumn: 2, // number of pinned columns starting from the left
frozenRow: 3, // number of pinned columns starting from the top
}
}
}
This is basically the same thing as previous code sample, except that you will set the Grid Option property frozenBottom
to true and that it's.
export class GridBasicComponent {
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
attached(): void {
// your columns definition
this.columnDefinitions = [];
this.gridOptions = {
alwaysShowVerticalScroll: false, // disable scroll since we don't want it to show on the left pinned columns
frozenColumn: 2, // number of pinned columns starting from the left
frozenRow: 3, // number of pinned columns (starting from bottom with next property)
frozenBottom: true, // this will make rows to be pinned starting from the bottom and the number of rows will be 3
}
}
}
You can change the number of pinned columns/rows and even the pinning of columns from top to bottom. For a demo of what that could look like, take a look at the Animated Gif Demo below.
<div class="row col-sm-12">
<span>
<label for="">Pinned Rows: </label>
<input type="number"
value.bind="frozenRowCount">
<button class="btn btn-default btn-xs"
click.delegate="changeFrozenRowCount()">
Set
</button>
</span>
<span style="margin-left: 10px">
<label for="">Pinned Columns: </label>
<input type="number"
value.bind="frozenColumnCount">
<button class="btn btn-default btn-xs"
click.delegate="changeFrozenColumnCount()">
Set
</button>
</span>
<span style="margin-left: 15px">
<button class="btn btn-default btn-sm" click.delegate="toggleFrozenBottomRows()">
<i class="fa fa-random fa-lg"></i> Toggle Pinned Rows
</button>
<span style="font-weight: bold;">: ${ isFrozenBottom ? 'Bottom' : 'Top' }</span>
</span>
</div>
<div class="gridId">
</div>
export class GridBasicComponent {
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
isFrozenBottom = false;
attached(): void {
// your columns definition
this.columnDefinitions = [];
this.gridOptions = {
alwaysShowVerticalScroll: false, // disable scroll since we don't want it to show on the left pinned columns
frozenColumn: 2, // number of pinned columns starting from the left
frozenRow: 3, // number of pinned columns starting from the top
}
}
/** change dynamically, through slickgrid "setOptions()" the number of pinned columns */
changeFrozenColumnCount() {
if (this.sgb.slickGrid.setOptions) {
this.sgb.slickGrid.setOptions({
frozenColumn: this.frozenColumnCount
});
}
}
/** change dynamically, through slickgrid "setOptions()" the number of pinned rows */
changeFrozenRowCount() {
if (this.sgb.slickGrid.setOptions) {
this.sgb.slickGrid.setOptions({
frozenRow: this.frozenRowCount
});
}
}
/** toggle dynamically, through slickgrid "setOptions()" the top/bottom pinned location */
toggleFrozenBottomRows() {
if (this.sgb.slickGrid.setOptions) {
this.sgb.slickGrid.setOptions({
frozenBottom: !this.isFrozenBottom
});
this.isFrozenBottom = !this.isFrozenBottom; // toggle the variable
}
}
}
- Slickgrid-Universal Wikis
- Installation
- Styling
- Interfaces/Models
- Column Functionalities
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Column Picker
- Composite Editor Modal
- Custom Tooltip
- Context Menu
- Custom Footer
- Export to Excel
- Export to File (csv/txt)
- Grid Menu
- Grid State & Presets
- Grouping & Aggregators
- Header Menu & Header Buttons
- Pinning (frozen) of Columns/Rows
- Row Selection
- Tree Data Grid
- SlickGrid & DataView objects
- Backend Services