Row Pinning in EJ2 Vue Grid Control
The Vue Data Grid control provides option to pin specific rows at the top, ensuring important information remains visible while scrolling vertically. This feature is useful when you want to keep specific rows always visible for quick reference or priority viewing, regardless of user interactions.
To enable the row pinning feature, configure the isRowPinned callback function, which returns true or false based on the required condition. The function receives each row’s data as input, allowing the pinning logic to be determined. It executes only during initial rendering, ensuring that any condition defined within it is evaluated during that initial stage.
This functionality does not change the grid’s overall content height, keeping the content area fully visible and scrollable even when multiple rows are pinned. This behavior prevents pinned rows from overlapping or obscuring the scrollable content, maintaining a consistent layout and smooth scrolling experience. Pinned rows are displayed in a fixed region above the content area, while the grid preserves its original height and continues to provide unobstructed interaction with all other rows.
The following example pins rows with “Critical” priority and “Open” status at the top using the isRowPinned callback function.
<template>
<div id="app">
<ejs-grid :dataSource='data' :isRowPinned='isRowPinned' height="200px">
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
const isRowPinned = function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
provide('grid', []);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style><template>
<div id="app">
<ejs-grid :dataSource='data' :isRowPinned="isRowPinned" height='200px'>
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
export default {
name: "App",
components: {
"ejs-grid":GridComponent,
"e-columns":ColumnsDirective,
"e-column":ColumnDirective
},
data() {
return {
data: data,
};
},
methods: {
isRowPinned:function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
},
provide: {
grid: []
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style>Pinning rows requires a primary key column for mapping the pinned rows to their original records. To define the primary key, set columns->isPrimaryKey to true in particular column.
Paging with row pinning
Row pinning in the Grid control keeps important rows visible at the top while navigating through pages. Pinned rows are not counted as part of the page size and remain fixed at the top of the grid. For example, if pageSettings->pageSize is set to “10” and “2” rows are pinned, those “2” rows stay at the top, and the grid displays “10” additional rows beneath them. When moving to another page, the pinned rows remain fixed at the top, and the next set of “10” records is rendered below.
<template>
<div id="app">
<ejs-grid :dataSource='data' :allowPaging="true" :pageSettings="pageSettings" :isRowPinned='isRowPinned' height="200px">
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
const pageSettings = { pageSize: 15 };
const isRowPinned = function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
provide('grid', [Page]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style><template>
<div id="app">
<ejs-grid :dataSource='data' :isRowPinned="isRowPinned" :allowPaging="true" :pageSettings="pageSettings" height='200px'>
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Page, } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
export default {
name: "App",
components: {
"ejs-grid":GridComponent,
"e-columns":ColumnsDirective,
"e-column":ColumnDirective
},
data() {
return {
data: data,
pageSettings: { pageSize: 15 }
};
},
methods: {
isRowPinned:function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
},
provide: {
grid: [Page]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style>Pinned rows selection
Pinned rows can be selected in the same way as regular rows. Their selection state is always synchronized with the corresponding data rows through the primary key value. This ensures consistent behavior during all grid operations, including paging, sorting, and filtering. Whether selection is performed using the mouse, keyboard, or checkbox selection, pinned rows always display the same selection state as their associated data rows.
<template>
<div id="app">
<ejs-grid :dataSource='data' :isRowPinned="isRowPinned" :allowPaging="true" :pageSettings="pageSettings" height="200px">
<e-columns>
<e-column type="checkbox" width="70"></e-column>
<e-column field="TaskID" headerText="Task ID" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
const pageSettings = { pageSize: 15 };
const isRowPinned = function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
provide('grid', [Page]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style><template>
<div id="app">
<ejs-grid :dataSource='data' :isRowPinned="isRowPinned" :allowPaging="true" :pageSettings="pageSettings" height='200px'>
<e-columns>
<e-column type="checkbox" width="70"></e-column>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Page, } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
export default {
name: "App",
components: {
"ejs-grid":GridComponent,
"e-columns":ColumnsDirective,
"e-column":ColumnDirective
},
data() {
return {
data: data,
pageSettings: { pageSize: 15 }
};
},
methods: {
isRowPinned:function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
},
provide: {
grid: [Page]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style>The selectionSettings->persistSelection will be automatically enabled when pinning the rows using the
isRowPinnedcallback function.
Filtering and sorting with pinned rows
Row pinning remains fully compatible with filtering and sorting operations in the Grid. When a filter is applied, both the pinned section and the scrollable content display only the rows that meet the filter criteria, ensuring consistent and predictable results. This unified filtering behavior keeps the interface clear and prevents mismatches between pinned and unpinned data.
When sorting is applied to any column, pinned rows are reordered using the same sorting rules while remaining fixed at the top of the grid. This ensures that pinned rows stay visible and correctly positioned, even as the rest of the data is reorganized. The combined behavior provides a smooth and intuitive experience, allowing data to be refined and analyzed without losing visibility of important pinned records.
<template>
<div id="app">
<ejs-grid :dataSource='data' :allowPaging="true" :pageSettings="pageSettings" :isRowPinned='isRowPinned' :allowSorting="true" :allowFiltering="true" :filterSettings="filterSettings" height="200px">
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Sort, Filter } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
const filterSettings = { type: 'Menu' };
const pageSettings = { pageSize: 15 };
const isRowPinned = function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
provide('grid', [Page, Sort, Filter]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style><template>
<div id="app">
<ejs-grid :dataSource='data' :isRowPinned="isRowPinned" :allowPaging="true" :pageSettings="pageSettings" :filterSettings="filterSettings" height='200px'>
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Page, Sort, Filter } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
export default {
name: "App",
components: {
"ejs-grid":GridComponent,
"e-columns":ColumnsDirective,
"e-column":ColumnDirective
},
data() {
return {
data: data,
filterSettings: { type: 'Menu' },
pageSettings: { pageSize: 15 }
};
},
methods: {
isRowPinned:function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
},
provide: {
grid: [Page, Sort, Filter]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style>CRUD operations with row pinning
Row pinning fully supports CRUD operations by keeping pinned rows and their corresponding original rows synchronized. Any edit, update, or deletion applied to a pinned row is immediately reflected in the original row, and any change made to the original row is likewise mirrored in the pinned row. This ensures consistent and accurate data across both views.
<template>
<div id="app">
<ejs-grid :dataSource='data' :height='150' :allowPaging="true" :pageSettings="pageSettings" :isRowPinned='isRowPinned' :toolbar="toolbar" :editSettings="editSettings">
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, Edit, Toolbar } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
const editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true };
const toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
const pageSettings = { pageSize: 15 };
const isRowPinned = function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
provide('grid', [Page, Edit, Toolbar]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style><template>
<div id="app">
<ejs-grid :dataSource='data' :height='150' :isRowPinned="isRowPinned" :allowPaging="true" :pageSettings="pageSettings" :toolbar="toolbar" :editSettings="editSettings" >
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Page, Toolbar, Edit } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
export default {
name: "App",
components: {
"ejs-grid":GridComponent,
"e-columns":ColumnsDirective,
"e-column":ColumnDirective
},
data() {
return {
data: data,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
pageSettings: { pageSize: 15 }
};
},
methods: {
isRowPinned:function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
},
provide: {
grid: [Page, Edit, Toolbar]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style>Dynamic row pinning
Row pinning provides dynamic control through the built-in context menu, allowing quick actions to pin or remove pinned rows. Using options such as PinRow and UnpinRow, any row can be right-clicked to pin it to the top or quickly remove it from the pinned section.
<template>
<div id="app">
<ejs-grid :dataSource='data' :allowPaging="true" :isRowPinned="isRowPinned" :pageSettings="pageSettings" height="200px" :contextMenuItems="contextMenuItems">
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script setup>
import { provide } from "vue";
import { GridComponent as EjsGrid, ColumnDirective as EColumn, ColumnsDirective as EColumns, Page, ContextMenu } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
const contextMenuItems = ['PinRow', 'UnpinRow'];
const pageSettings = { pageSize: 15 };
const isRowPinned = function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
provide('grid', [Page, ContextMenu]);
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style><template>
<div id="app">
<ejs-grid :dataSource='data' :allowPaging="true" :isRowPinned="isRowPinned" :pageSettings="pageSettings" height='200px' :contextMenuItems="contextMenuItems">
<e-columns>
<e-column field="TaskID" headerText="Task ID" :isPrimaryKey="true" textAlign="Right" width="100"></e-column>
<e-column field="Title" headerText="Title" width="120"></e-column>
<e-column field="Priority" headerText="Priority" textAlign="Right" width="120" format="N0"></e-column>
<e-column field="Status" headerText="Status" width="150"></e-column>
<e-column field="Assignee" headerText="Assignee" width="150"></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import { GridComponent, ColumnsDirective, ColumnDirective, Page, ContextMenu } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
export default {
name: "App",
components: {
"ejs-grid":GridComponent,
"e-columns":ColumnsDirective,
"e-column":ColumnDirective
},
data() {
return {
data: data,
contextMenuItems: ['PinRow', 'UnpinRow'],
pageSettings: { pageSize: 15 }
};
},
methods: {
isRowPinned:function(data){
if (data && data.Status === 'Open' && data.Priority === 'Critical') {
return true;
}
return false;
}
},
provide: {
grid: [Page, ContextMenu]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-calendars/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material3.css";
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material3.css";
</style>Limitation
Row pinning is not compatible with the following features:
- Column and row spanning
- Row template
- Detail template
- Row drag and drop
- Grouping
- Aggregate
- Cell selection
- Frozen rows
- Excel and PDF export
- Adaptive UI