ejs-grid
represents the Angular Grid Component.
<ejs-grid [dataSource]='data' allowPaging='true' allowSorting='true'></ejs-grid>
One of the adaptiveUIMode enumeration that specifies the Adaptive Mode. The default value is Both.
Defaults to Both
Configures the Grid aggregate rows.
<ejs-grid [dataSource]="data">
<e-columns>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='Freight' headerText='Freight' width='150' format='C2' textAlign='Right'></e-column>
</e-columns>
<e-aggregates>
<e-aggregate>
<e-columns>
<e-column type="Sum" field="Freight" format="C2">
<ng-template #footerTemplate let-data>Sum: {{data.Sum}}</ng-template>
</e-column>
</e-columns>
</e-aggregate>
</e-aggregates>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { AggregateService,GridComponent } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [AggregateService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Check the
Aggregates
for its configuration.
Defaults to []
boolean
If allowExcelExport
set to true, then it will allow the user to export grid to Excel file.
Check the
ExcelExport
to configure exporting document.
<ejs-grid [dataSource]='data' [toolbar]='toolbar' [allowExcelExport]='true'>
</ejs-grid>
import { Component, OnInit} from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, ToolbarService, ExcelExportService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ToolbarService, ExcelExportService]
})
export class AppComponent implements OnInit {
public data: Object[];
public toolbar: string[];
public ngOnInit(): void {
this.data = orderDetails;
this.toolbar = ['ExcelExport'];
}
}
Defaults to false
boolean
If allowFiltering
set to true the filter bar will be displayed.
If set to false the filter bar will not be displayed.
Filter bar allows the user to filter grid records with required criteria.
Check the
Filtering
to customize its default behavior.
<ejs-grid [dataSource]='data' [allowFiltering]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, FilterService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[FilterService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If allowGrouping
set to true, then it will allow the user to dynamically group or ungroup columns.
Grouping can be done by drag and drop columns from column header to group drop area.
Check the
Grouping
to customize its default behavior.
<ejs-grid [dataSource]='data' [allowGrouping]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent,GroupService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[GroupService]
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
Enables or disables the key board interaction of Grid.
Defaults to true
boolean
If allowMultiSorting
set to true, then it will allow the user to sort multiple column in the grid.
allowSorting
should be true.
<ejs-grid [dataSource]='data' [allowSorting]='true' [allowMultiSorting]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, SortService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[SortService]
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If allowPaging
is set to true, the pager renders at the footer of the Grid. It is used to handle page navigation in the Grid.
Check the
Paging
to configure the grid pager.
Defaults to false
boolean
If allowPdfExport
set to true, then it will allow the user to export grid to Pdf file.
Check the
Pdfexport
to configure the exporting document.
<ejs-grid [dataSource]='data' [toolbar]='toolbar' [allowPdfExport]='true'>
</ejs-grid>
import { Component, OnInit, ViewChild } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, ToolbarService, PdfExportService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ToolbarService, PdfExportService ]
})
export class AppComponent implements OnInit {
public data: Object[];
public toolbar: string[];
public ngOnInit(): void {
this.data = orderDetails;
this.toolbar = ['PdfExport'];
}
}
Defaults to false
boolean
If allowReordering
is set to true, Grid columns can be reordered.
Reordering can be done by drag and drop of a particular column from one index to another index.
If Grid is rendered with stacked headers, reordering is allowed only at the same level as the column headers.
<ejs-grid [dataSource]='data' [allowReordering]="true">
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, ReorderService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[ReorderService]
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If allowResizing
is set to true, Grid columns can be resized.
<ejs-grid [dataSource]='data' [allowResizing]="true">
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, ResizeService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[ResizeService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If allowRowDragAndDrop
is set to true, you can drag and drop grid rows at another grid.
<ejs-grid [dataSource]='data' [allowRowDragAndDrop]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, RowDDService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[RowDDService]
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If allowSelection
is set to true, it allows selection of (highlight row) Grid records by clicking it.
<ejs-grid [dataSource]='data' [allowSelection]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to true
boolean
If allowSorting
is set to true, it allows sorting of grid records when column header is clicked.
Check the
Sorting
to customize its default behavior.
<ejs-grid [dataSource]='data' [allowSorting]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent, SortService} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[SortService]
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If allowTextWrap
set to true,
then text content will wrap to the next line when its text content exceeds the width of the Column Cells.
<ejs-grid [dataSource]='data' [allowTextWrap]='true'>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to false
boolean
If autoFit
set to true, then it will auto fit the columns based on given width.
Defaults to false
Defines Grid options to render child Grid.
It requires the queryString
for parent
and child relationship.
Check the
Child Grid
for its configuration.
Defaults to ”
Defines the mode of clip. The available modes are,
Clip
: Truncates the cell content when it overflows its area.
Ellipsis
: Displays ellipsis when the cell content overflows its area.
EllipsisWithTooltip
: Displays ellipsis when the cell content overflows its area,
also it will display the tooltip while hover on ellipsis is applied.
<ejs-grid [dataSource]='data' [clipMode]="Ellipsis">
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderDetails } from './data';
import { GridComponent} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderDetails;
}
}
Defaults to Ellipsis
clipboardModule
is used to handle Grid copy action.
Configures the column chooser in the Grid.
Defaults to { columnChooserOperator: ‘startsWith’ }
ColumnMenuItem[]
| ColumnMenuItemModel[]
columnMenuItems
defines both built-in and custom column menu items.
The available built-in items are,
AutoFitAll
- Auto fit the size of all columns.AutoFit
- Auto fit the current column.Group
- Group by current column.Ungroup
- Ungroup by current column.SortAscending
- Sort the current column in ascending order.SortDescending
- Sort the current column in descending order.Filter
- Filter options will show based on filterSettings property like checkbox filter, excel filter, menu filter.Defaults to null
ColumnMenu
The columnMenuModule
is used to manipulate column menu items and its action in the Grid.
columnQueryMode
provides options to retrive data from the datasource.Their types are
All
: It Retrives whole datasource.Schema
: Retrives data for all the defined columns in grid from the datasource.ExcludeHidden
: Retrives data only for visible columns of grid from the dataSource.Defaults to All
Column[]
| string[]
| ColumnModel[]
Defines the schema of dataSource.
If the columns
declaration is empty or undefined then the columns
are automatically generated from data source.
<ejs-grid [dataSource]="data">
<e-columns>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='Freight' headerText='Freight' width='150' format='C2' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to []
ContextMenuItem[]
| ContextMenuItemModel[]
contextMenuItems
defines both built-in and custom context menu items.
The available built-in items are,
AutoFitAll
- Auto fit the size of all columns.AutoFit
- Auto fit the current column.Group
- Group by current column.Ungroup
- Ungroup by current column.Edit
- Edit the current record.Delete
- Delete the current record.Save
- Save the edited record.Cancel
- Cancel the edited state.Copy
- Copy the selected records.PdfExport
- Export the grid as Pdf format.ExcelExport
- Export the grid as Excel format.CsvExport
- Export the grid as CSV format.SortAscending
- Sort the current column in ascending order.SortDescending
- Sort the current column in descending order.FirstPage
- Go to the first page.PrevPage
- Go to the previous page.LastPage
- Go to the last page.NextPage
- Go to the next page.Defaults to null
The contextMenuModule
is used to handle context menu items and its action in the Grid.
string
Defines the own class for the grid element.
Defaults to ”
ActionArgs
Gets or sets the current action details.
Defaults to {}
Object[]
Gets the currently visible records of the Grid.
Defaults to []
Object
| DataManager
| DataResult
It is used to render grid table rows.
If the dataSource
is an array of JavaScript objects,
then Grid will create instance of DataManager
from this dataSource
.
If the dataSource
is an existing DataManager
,
the Grid will not initialize a new one.
Check the available
Adaptors
to customize the data operation.
<ejs-grid [dataSource]="data"> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to []
any
The detail template allows you to show or hide additional information about a particular row.
It accepts either the template string or the HTML element ID.
Defaults to null
The editModule
is used to handle Grid content manipulation.
Configures the edit settings.
<ejs-grid [dataSource]="data" [editSettings]='editSettings' [toolbar]='toolbar'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent, EditService, ToolbarService, EditSettingsModel,ToolbarItems} from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [EditService, ToolbarService]
})
export class AppComponent implements OnInit{
public data: Object[];
public editSettings: EditSettingsModel;
public toolbar: ToolbarItems[];
public ngOnInit(): void {
this.data = orderData;
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true };
this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
}
}
Defaults to { allowAdding: false, allowEditing: false, allowDeleting: false, mode:‘Normal’,allowEditOnDblClick: true, showConfirmDialog: true, showDeleteConfirmDialog: false }
string
Defines the version for Grid persistence.
Defaults to ”
any
The empty record template that renders customized element or text or image instead of displaying the empty record message in the grid.
It accepts either the template string or the HTML element ID.
Defaults to null
boolean
If enableAdaptiveUI
set to true the grid filter, sort, and edit dialogs render adaptively.
Defaults to false
boolean
If enableAltRow
is set to true, the grid will render with e-altrow
CSS class to the alternative tr elements.
Check the
AltRow
to customize the styles of alternative rows.
<ejs-grid [dataSource]="data" [enableAltRow]="true"> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to true
boolean
If enableAutoFill
is set to true, then the auto fill icon will displayed on cell selection for copy cells.
It requires the selection mode
to be Cell and cellSelectionMode
to be Box
.
<ejs-grid [dataSource]="data" [enableAutoFill]="true" [selectionSettings]="selectionOptions" > </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,SelectionSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public selectionOptions: SelectionSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.selectionOptions = { cellSelectionMode: 'Box', mode: 'Cell' };
}
}
Defaults to false
boolean
If enableColumnVirtualization
set to true, then the Grid will render only the columns visible within the view-port
and load subsequent columns on horizontal scrolling. This helps to load large dataset of columns in Grid.
<ejs-grid [dataSource]="data" height='300' [enableVirtualization]='true' [enableColumnVirtualization]='true'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,VirtualScrollService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[VirtualScrollService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to false
boolean
If enableHeaderFocus
set to true, then header element will be focused when focus moves to grid.
Defaults to false
boolean
If enableHover
is set to true, the row hover is enabled in the Grid.
<ejs-grid [dataSource]="data" [enableHover]="true" > </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to true
boolean
Specifies whether to display or remove the untrusted HTML values in the Grid component. If ‘enableHtmlSanitizer’ set to true, the component will sanitize any suspected untrusted strings and scripts before rendering them.
Defaults to false
boolean
If enableImmutableMode
is set to true, the grid will reuse old rows if it exists in the new result instead of
full refresh while performing the grid actions.
Defaults to false
boolean
If enableInfiniteScrolling
set to true, then the data will be loaded in Grid when the scrollbar reaches the end.
This helps to load large dataset in Grid.
<ejs-grid [dataSource]="data" height='300' enableInfiniteScrolling='true' > </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,InfiniteScrollService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [InfiniteScrollService]
})
export class AppComponent implements OnInit{
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to false
boolean
Enable or disable persisting component’s state between page reloads.
Defaults to false
boolean
Enable or disable rendering component in right to left direction.
Defaults to false
boolean
If ‘enableStickyHeader’ set to true, then the user can able to make the column headers visible when the document is scrolled.
Defaults to false
boolean
Specifies the shimmer effect for Grid virtual and infinite scrolling.
Defaults to true
boolean
If enableVirtualization
set to true, then the Grid will render only the rows visible within the view-port
and load subsequent rows on vertical scrolling. This helps to load large dataset in Grid.
<ejs-grid [dataSource]="data" height='300' [enableVirtualization]='true'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,VirtualScrollService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[VirtualScrollService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to false
ExcelExport
The excelExportModule
is used to handle Excel exporting feature in the Grid.
string[]
Defines the id of the grids that needs to be exported
Defaults to null
The filterModule
is used to manipulate filtering in the Grid.
Configures the filter settings of the Grid.
<ejs-grid [dataSource]="data" [allowFiltering]='true' [filterSettings]='filterOptions' > </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,FilterSettingsModel, FilterService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[FilterService]
})
export class AppComponent implements OnInit{
public data: Object[];
public filterOptions: FilterSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.filterOptions = { type: 'Menu'};
}
}
Defaults to {columns: [], type: ‘FilterBar’, mode: ‘Immediate’, showFilterBarStatus: true, immediateModeDelay: 1500 , operators: {}}
number
Gets or sets the number of frozen columns.
<ejs-grid [dataSource]="data" [frozenColumns]='1' > </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,FreezeService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[FreezeService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to 0
number
Gets or sets the number of frozen rows.
<ejs-grid [dataSource]="data" [frozenRows]='2' > </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GridComponent,FreezeService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers:[FreezeService]
})
export class AppComponent implements OnInit {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to 0
Defines the mode of grid lines. The available modes are,
Both
: Displays both horizontal and vertical grid lines.None
: No grid lines are displayed.Horizontal
: Displays the horizontal grid lines only.Vertical
: Displays the vertical grid lines only.Default
: Displays grid lines based on the theme. <ejs-grid [dataSource]='data' gridLines='Both'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to Default
The groupModule
is used to manipulate grouping behavior in the Grid.
Configures the group settings.
<ejs-grid [dataSource]='data' [allowGrouping]="true" [groupSettings]="groupOptions">
<e-columns>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='Freight' headerText='Freight' width='150' format='C2' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { GroupService, GroupSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [GroupService]
})
export class AppComponent {
public data: Object[];
public groupOptions: GroupSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.groupOptions = { columns: ['Freight'] };
}
}
Defaults to {showDropArea: true, showToggleButton: false, showGroupedColumn: false, showUngroupButton: true, columns: []}
string
| number
Defines the scrollable height of the grid content.
<ejs-grid [dataSource]='data' height='400'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to ‘auto’
Defines the hierarchy grid print modes. The available modes are
Expanded
- Prints the master grid with expanded child grids.All
- Prints the master grid with all the child grids.None
- Prints the master grid alone.Defaults to Expanded
InfiniteScroll
The infiniteScrollModule
is used to manipulate infinite scrolling in the Grid.
Configures the infinite scroll settings.
<ejs-grid [dataSource]='data' [enableInfiniteScrolling]='true' [infiniteScrollSettings]='infiniteOptions' [pageSettings]='pageOptions' height:'400'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { InfiniteScrollService, InfiniteScrollSettingsModel, PageSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [InfiniteScrollService]
})
export class AppComponent {
public data: Object[];
public pageOptions: PageSettingsModel;
public infiniteOptions: InfiniteScrollSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.pageOptions = { pageSize: 50 };
this.infiniteOptions = { enableCache: true, maxBlocks: 3, initialBlocks: 3 };
}
}
Defaults to { enableCache: false, maxBlocks: 5, initialBlocks: 5 }
KeyboardEvents
The keyboardModule
is used to manipulate keyboard interactions in the Grid.
Configures the Loading Indicator of the Grid.
Defaults to {indicatorType: ‘Spinner’}
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ”
Configures the pager in the Grid.
<ejs-grid [dataSource]='data' [allowPaging]='true' [pageSettings]='pageOptions'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { PageService, PageSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [PageService]
})
export class AppComponent {
public data: Object[];
public optiopageOptionsns: PageSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.pageOptions = { currentPage: 1, pageSize: 12, pageCount: 8, pageSizes: true };
}
}
Defaults to {currentPage: 1, pageSize: 12, pageCount: 8, enableQueryString: false, pageSizes: false, template: null}
The pagerModule
is used to manipulate paging in the Grid.
any
It used to render pager template
Defaults to null
ParentDetails
Gets the parent Grid details.
Defaults to {}
PdfExport
The pdfExportModule
is used to handle PDF exporting feature in the Grid.
Defines the print modes. The available print modes are
AllPages
: Prints all pages of the Grid.CurrentPage
: Prints the current page of the Grid. <ejs-grid [dataSource]='data' printMode='CurrentPage' [allowPaging]='true' [toolbar]='toolbarOptions'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { PageService, ToolbarService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [PageService, ToolbarService]
})
export class AppComponent {
public data: Object[];
public toolbarOptions: string[];
public ngOnInit(): void {
this.data = orderData;
this.toolbarOptions = ['Print'];
}
}
Defaults to AllPages
The printModule
is used to handle the printing feature of the Grid.
Query
Defines the external Query
that will be executed along with data processing.
<ejs-grid [dataSource]='data' [query]='query'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { DataManager, ODataAdaptor, Query } from '@syncfusion/ej2-data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: DataManager;
public query: Query;
public ngOnInit(): void {
this.data = new DataManager({
url: 'https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders?$top=7',
adaptor: new ODataAdaptor()
});
this.query = new Query().addParams('ej2grid', 'true');
}
}
Defaults to null
string
Defines the relationship between parent and child datasource. It acts as the foreign key for parent datasource.
Defaults to ”
The reorderModule
is used to manipulate reordering in the Grid.
boolean
requireTemplateRef
is set to false in the load event, then the template element can’t be accessed in grid queryCellInfo, and rowDataBound events.Defaults to true
Defines the resizing behavior of the Grid.
Defaults to {mode:“Normal”}
RowDD
The rowDragAndDropModule
is used to manipulate row reordering in the Grid.
Configures the row drop settings.
Defaults to {targetID: ”}
number
Defines the height of Grid rows.
<ejs-grid [dataSource]='data' rowHeight='20'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to null
Defines the grid row elements rendering direction. The available directions are,
Horizontal
: Renders the grid row elements in the horizontal directionVertical
: Renders the grid row elements in the vertical directionDefaults to Horizontal
any
The row template that renders customized rows from the given template. By default, Grid renders a table row for every data source item.
- It accepts either template string or HTML element ID.
- The row template must be a table row. Check the
Row Template
customization.
Defaults to null
The scrollModule
is used to manipulate scrolling in the Grid.
The searchModule
is used to manipulate searching in the Grid.
Configures the search behavior in the Grid.
<ejs-grid [dataSource]='data' [searchSettings]='searchOptions' [toolbar]='toolbarOptions'>
<e-columns>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='Freight' headerText='Freight' width='150' format='C2' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { ToolbarService, SearchService, SearchSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ToolbarService, SearchService]
})
export class AppComponent {
public data: Object[];
public toolbarOptions: string[];
public searchOptions: SearchSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.toolbarOptions = ['Search'];
this.searchOptions = { fields: ['CustomerName'], key: 'Ha' };
}
}
Defaults to { ignoreCase: true, fields: [], operator: ‘contains’, key: ” }
number
The selectedRowIndex
allows you to select a row at initial rendering.
You can also get the currently selected row index.
<ejs-grid [dataSource]='data' [selectedRowIndex]='5'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to -1
The selectionModule
is used to manipulate selection behavior in the Grid.
Configures the selection settings.
<ejs-grid [dataSource]='data' [selectionSettings]='selectionOptions'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { SelectionSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public selectionOptions: SelectionSettingsModel;
public ngOnInit(): void {
this.data = orderData;
this.selectionOptions = { mode: 'Cell', cellSelectionMode: 'Box', type: 'Multiple' };
}
}
Defaults to {mode: ‘Row’, cellSelectionMode: ‘Flow’, type: ‘Single’}
boolean
If showColumnChooser
is set to true, it allows you to dynamically show or hide columns.
Check the
ColumnChooser
for its configuration.
<ejs-grid [dataSource]='data' [toolbar]='toolbarOptions' [showColumnChooser]='true'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { ColumnChooserService , ToolbarService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ColumnChooserService, ToolbarService]
})
export class AppComponent {
public data: Object[];
public toolbarOptions: string[];
public ngOnInit(): void {
this.data = orderData;
this.toolbarOptions = ['ColumnChooser'];
}
}
Defaults to false
boolean
If showColumnMenu
set to true, then it will enable the column menu options in each columns.
Check the
Column menu
for its configuration.
<ejs-grid [dataSource]='data' showColumnMenu='true'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { ColumnMenuService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ColumnMenuService]
})
export class AppComponent {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to false
The showHider
is used to manipulate column’s show/hide operation in the Grid.
Defaults to ”
The sortModule
is used to manipulate sorting in the Grid.
Configures the sort settings.
<ejs-grid [dataSource]='data' [allowSorting]='true' [sortSettings]='sortOptions'>
<e-columns>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='Freight' headerText='Freight' width='150' format='C2' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { SortService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [SortService]
})
export class AppComponent {
public data: Object[];
public sortOptions: object;
public ngOnInit(): void {
this.data = orderData;
this.sortOptions = { columns: [{ field: 'CustomerName', direction: 'Ascending' }] };
}
}
Defaults to {columns:[]}
Configures the text wrap in the Grid.
<ejs-grid [dataSource]='data' allowTextWrap='true' [textWrapSettings]='wrapOption'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public wrapOption: Object;
public ngOnInit(): void {
this.data = orderData;
this.wrapOption = { wrapMode: 'Both' };
}
}
Defaults to {wrapMode:“Both”}
[]
toolbar
defines the ToolBar items of the Grid.
It contains built-in and custom toolbar items.
If a string value is assigned to the toolbar
option, it is considered as the template for the whole Grid ToolBar.
If an array value is assigned, it is considered as the list of built-in and custom toolbar items in the Grid’s Toolbar.
The available built-in ToolBar items are:
CsvExport - Export the Grid to CSV(csvExport() method manually to make export.)
The following code example implements the custom toolbar items.
Check the
Toolbar
to customize its default items.
<ejs-grid [dataSource]='data' [toolbar]='toolbarOptions'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
import { ToolbarService } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ToolbarService]
})
export class AppComponent {
public data: Object[];
public toolbarOptions: string[];
public ngOnInit(): void {
this.data = orderData;
this.toolbarOptions = ['Search','Print'];
}
}
Defaults to null
The toolbarModule
is used to manipulate ToolBar items and its action in the Grid.
any
It used to render toolbar template
Defaults to null
string
| number
Defines the Grid width.
<ejs-grid [dataSource]='data' width='700'> </ejs-grid>
import { Component, OnInit } from '@angular/core';
import { orderData } from './data';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
public data: Object[];
public ngOnInit(): void {
this.data = orderData;
}
}
Defaults to ‘auto’
Adds a new record to the Grid. Without passing parameters, it adds empty rows.
editSettings.allowEditing
should be true.
Parameter | Type | Description |
---|---|---|
data (optional) | Object |
Defines the new add record data. |
index (optional) | number |
Defines the row index to be added |
Returns void
Changes the column width to automatically fit its content to ensure that the width shows the content without wrapping/hiding.
- This method ignores the hidden columns.
- Uses the
autoFitColumns
method in thedataBound
event to resize at initial rendering.- By specifying the start row index and end row index, providing the range within which the maximum width for that column should be considered when applying
autoFitColumns
.- The width of header rows is always calculated. If the width of a header row exceeds the specified range, its width will be allocated to the specific content rows.
Parameter | Type | Description |
---|---|---|
fieldNames (optional) | string | string[] |
Defines the column names. |
startRowIndex (optional) | number |
Specifies the start index of the content row. |
endRowIndex (optional) | number |
Specifies the end index of content row. |
Returns void
Apply the changes to the Grid in one batch after 50ms without refreshing the rows.
Parameter | Type | Description |
---|---|---|
changes | BatchChanges |
Defines changes to be updated. |
Returns void
Apply the changes to the Grid without refreshing the rows.
Parameter | Type | Description |
---|---|---|
changes | BatchChanges |
Defines changes to be updated. |
Returns void
Calculates the page size by parent element height
Parameter | Type | Description |
---|---|---|
containerHeight | number | string |
specifies the container height |
Returns number
Remove the existing columns along with the grid actions like sorting, filtering, searching, grouping, aggregate, etc., and grid will refresh with new columns based on the updated new data source.
- If no columns are specified while changing the data source, then the columns are auto generated in the Grid based on the list of columns in the updated data source.
Parameter | Type | Description |
---|---|---|
dataSource (optional) | Object | DataManager | DataResult |
Assign the new datasource. |
columns (optional) | Column[] | string[] | ColumnModel[] |
Defines columns. |
Returns void
Deselects the currently selected cells.
Returns void
Clears all the filtered rows of the Grid.
Parameter | Type | Description |
---|---|---|
fields (optional) | string[] |
Defines the Fields |
Returns void
Clears all the grouped columns of the Grid.
Returns void
Deselects the currently selected rows.
Returns void
Deselects the current selected rows and cells.
Returns void
Clears all the sorted columns of the Grid.
Returns void
Cancels edited state.
Returns void
Copy the selected rows or cells data into clipboard.
Parameter | Type | Description |
---|---|---|
withHeader (optional) | boolean |
Specifies whether the column header text needs to be copied along with rows or cells. |
Returns void
Export Grid data to CSV file.
Parameter | Type | Description |
---|---|---|
excelExportProperties (optional) | ExcelExportProperties |
Defines the export properties of the Grid. |
isMultipleExport (optional) | boolean |
Define to enable multiple export. |
workbook (optional) | Workbook |
Defines the Workbook if multiple export is enabled. |
isBlob (optional) | boolean |
If ‘isBlob’ set to true, then it will be returned as blob data. |
Returns Promise
Delete a record with Given options. If fieldname and data is not given then grid will delete the selected record.
editSettings.allowDeleting
should be true.
Parameter | Type | Description |
---|---|---|
fieldname (optional) | string |
Defines the primary key field, ‘Name of the column’. |
data (optional) | Object |
Defines the JSON data of the record to be deleted. |
Returns void
Delete any visible row by TR element.
Parameter | Type | Description |
---|---|---|
tr | HTMLTableRowElement |
Defines the table row element. |
Returns void
Destroys the component (detaches/removes all event handlers, attributes, classes, and empties the component element).
Returns void
Destroys the given template reference.
Parameter | Type | Description |
---|---|---|
propertyNames (optional) | string[] |
Defines the collection of template name. |
index (optional) | any |
specifies the index |
callback (optional) | Function |
Defines the callback function that is triggered after the template is cleared |
Returns void
Collapses all the detail rows of the Grid.
Returns void
Expands all the detail rows of the Grid.
Returns void
Changes a particular cell into edited state based on the row index and field name provided in the batch
mode.
Parameter | Type | Description |
---|---|---|
index | number |
Defines row index to edit a particular cell. |
field | string |
Defines the field name of the column to perform batch edit. |
Returns void
Enables or disables ToolBar items.
Parameter | Type | Description |
---|---|---|
items | string[] |
Defines the collection of itemID of ToolBar items. |
isEnable | boolean |
Defines the items to be enabled or disabled. |
Returns void
If Grid is in editable state, you can save a record by invoking endEdit.
Returns void
Export Grid data to Excel file(.xlsx).
Parameter | Type | Description |
---|---|---|
excelExportProperties (optional) | ExcelExportProperties |
Defines the export properties of the Grid. |
isMultipleExport (optional) | boolean |
Define to enable multiple export. |
workbook (optional) | Workbook |
Defines the Workbook if multiple export is enabled. |
isBlob (optional) | boolean |
If ‘isBlob’ set to true, then it will be returned as blob data. |
Returns Promise
Filters grid row by column name with the given options.
Parameter | Type | Description |
---|---|---|
fieldName | string |
Defines the field name of the column. |
filterOperator | string |
Defines the operator to filter records. |
filterValue | string | number | Date | boolean | number[] | string[] | Date[] | boolean[] | null |
Defines the value used to filter records. |
predicate (optional) | string |
Defines the relationship between one filter query and another by using AND or OR predicate. |
matchCase (optional) | boolean |
If match case is set to true, the grid filters the records with exact match. if false, it filters case insensitive records (uppercase and lowercase letters treated the same). |
ignoreAccent (optional) | boolean |
If ignoreAccent set to true, then filter ignores the diacritic characters or accents while filtering. |
actualFilterValue (optional) | string |
Defines the actual filter value for the filter column. |
actualOperator (optional) | string |
Defines the actual filter operator for the filter column. |
Returns void
Initiates a complete refresh of the Grid’s column and layout. This method forces a full re-render of the Grid, ensuring that any dynamic changes to columns or layout are immediately reflected.
Returns void
Gets the added, edited,and deleted data before bulk save to the DataSource in batch mode.
Returns Object
Gets a cell by row and column index.
Parameter | Type | Description |
---|---|---|
rowIndex | number |
Specifies the row index. |
columnIndex | number |
Specifies the column index. |
Returns Element
Gets a Column by column name.
Parameter | Type | Description |
---|---|---|
field | string |
Specifies the column name. |
Returns Column
Gets a column by UID.
Parameter | Type | Description |
---|---|---|
uid | string |
Specifies the column UID. |
isColumns (optional) | boolean |
Defines the all columns. |
Returns Column
Gets the collection of column fields.
Returns string[]
Gets a column header by column name.
Parameter | Type | Description |
---|---|---|
field | string |
Specifies the column name. |
Returns Element
Gets a column header by column index.
Parameter | Type | Description |
---|---|---|
index | number |
Specifies the column index. |
Returns Element
Gets a column header by UID.
Parameter | Type | Description |
---|---|---|
uid | string |
Specifies the column uid. |
Returns Element
Gets a column index by column name.
Parameter | Type | Description |
---|---|---|
field | string |
Specifies the column name. |
Returns number
Gets a column index by UID.
Parameter | Type | Description |
---|---|---|
uid | string |
Specifies the column UID. |
Returns number
Gets the columns from the Grid.
Parameter | Type | Description |
---|---|---|
isRefresh (optional) | boolean |
Defines the boolean whether to refresh |
Returns Column[]
Gets the content div of the Grid.
Returns Element
Gets the content table of the Grid.
Returns Element
Get current visible data of grid.
Returns Object[]
Returns the data module used by the grid. Use this to access the current applied queries and data related configuration settings for the grid.
Returns Data
Gets all the Grid’s data rows.
Returns Element[]
Get the current Filter operator and field.
Returns FilterUI
Get all filtered records from the Grid and it returns array of objects for the local dataSource, returns a promise object if the Grid has remote data.
Returns Object[] | Promise
Gets the footer div of the Grid.
Returns Element
Gets the footer table element of the Grid.
Returns Element
Gets the foreign columns from Grid.
Returns Column[]
Gets all the Grid’s frozen table data rows.
Returns Element[]
Gets a frozen left column header by column index.
Parameter | Type | Description |
---|---|---|
index | number |
Specifies the column index. |
Returns Element
Gets a frozen right table cell by row and column index.
Parameter | Type | Description |
---|---|---|
rowIndex | number |
Specifies the row index. |
columnIndex | number |
Specifies the column index. |
Returns Element
Gets a frozen right column header by column index.
Parameter | Type | Description |
---|---|---|
index | number |
Specifies the column index. |
Returns Element
Gets all the Grid’s frozen right table data rows.
Returns Element[]
Gets a frozen right tables row element by index.
Parameter | Type | Description |
---|---|---|
index | number |
Specifies the row index. |
Returns Element
Gets the Grid’s frozen right content rows from frozen grid.
Returns Element[]
Gets a frozen tables row by index.
Parameter | Type | Description |
---|---|---|
index | number |
Specifies the row index. |
Returns Element
Gets the header div of the Grid.
Returns Element
Gets the header table element of the Grid.
Returns Element