Angular UI Components Documentation
This tutorial builds an Angular CLI application that shows a customer list in jqxGrid. It uses a data adapter for the rows, and a signal query to call grid methods from the component.
npm install -g @angular/cli
ng new jqwidgets-grid-app
cd jqwidgets-grid-app
npm install jqwidgets-ng
Angular 22 needs Node 22 or later. Answer No to server-side rendering when ng new asks.
In angular.json, add the base stylesheet and a theme to the styles array of the build target, then restart ng serve if it is running:
"styles": [
"node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css",
"node_modules/jqwidgets-ng/jqwidgets/styles/jqx.fluent.css",
"src/styles.css"
]
ng add jqwidgets-ng makes the same change and lets you pick the theme from a list.
jqxGrid reads rows through jqx.dataAdapter. The source object says where the rows are (localdata here, a url for server data) and which fields they have. With array rows, map gives the index of each field.
Put the data in its own file, src/app/customers.ts, to keep the component short:
export const CUSTOMERS: string[][] = [
['Alfreds Futterkiste', 'Maria Anders', 'Sales Representative', 'Obere Str. 57', 'Berlin', 'Germany'],
['Ana Trujillo Emparedados y helados', 'Ana Trujillo', 'Owner', 'Avda. de la Constitución 2222', 'México D.F.', 'Mexico'],
['Antonio Moreno Taquería', 'Antonio Moreno', 'Owner', 'Mataderos 2312', 'México D.F.', 'Mexico'],
['Around the Horn', 'Thomas Hardy', 'Sales Representative', '120 Hanover Sq.', 'London', 'UK'],
['Berglunds snabbköp', 'Christina Berglund', 'Order Administrator', 'Berguvsvägen 8', 'Luleå', 'Sweden'],
['Blauer See Delikatessen', 'Hanna Moos', 'Sales Representative', 'Forsterstr. 57', 'Mannheim', 'Germany'],
['Blondel père et fils', 'Frédérique Citeaux', 'Marketing Manager', '24, place Kléber', 'Strasbourg', 'France'],
['Bólido Comidas preparadas', 'Martín Sommer', 'Owner', 'C/ Araquil, 67', 'Madrid', 'Spain'],
['Bon app\'', 'Laurence Lebihan', 'Owner', '12, rue des Bouchers', 'Marseille', 'France'],
['Bottom-Dollar Markets', 'Elizabeth Lincoln', 'Accounting Manager', '23 Tsawassen Blvd.', 'Tsawassen', 'Canada'],
['Chop-suey Chinese', 'Yang Wang', 'Owner', 'Hauptstr. 29', 'Bern', 'Switzerland'],
['Ernst Handel', 'Roland Mendel', 'Sales Manager', 'Kirchgasse 6', 'Graz', 'Austria']
];
src/app/app.ts:
import { Component, signal, viewChild } from '@angular/core';
import { jqxGridComponent, jqxGridModule } from 'jqwidgets-ng/jqxgrid';
import { CUSTOMERS } from './customers';
@Component({ selector: 'app-root', imports: [jqxGridModule], templateUrl: './app.html' })
export class App {
readonly myGrid = viewChild.required<jqxGridComponent>('myGrid');
readonly selected = signal('none');
readonly source = {
datatype: 'array',
localdata: CUSTOMERS,
datafields: [
{ name: 'CompanyName', type: 'string', map: '0' },
{ name: 'ContactName', type: 'string', map: '1' },
{ name: 'Title', type: 'string', map: '2' },
{ name: 'Address', type: 'string', map: '3' },
{ name: 'City', type: 'string', map: '4' },
{ name: 'Country', type: 'string', map: '5' }
]
};
readonly dataAdapter = new jqx.dataAdapter(this.source);
readonly columns = [
{ text: 'Company Name', datafield: 'CompanyName', width: 240 },
{ text: 'Contact Name', datafield: 'ContactName', width: 160 },
{ text: 'Contact Title', datafield: 'Title', width: 170 },
{ text: 'Address', datafield: 'Address', width: 200 },
{ text: 'City', datafield: 'City', width: 120 },
{ text: 'Country', datafield: 'Country' }
];
onRowSelect(event: any): void {
this.selected.set(event.args.row.CompanyName);
}
exportToExcel(): void {
this.myGrid().exportview('xlsx', 'customers');
}
}
src/app/app.html:
<jqxGrid #myGrid
[theme]="'fluent'"
[width]="'100%'"
[source]="dataAdapter"
[columns]="columns"
[autoheight]="true"
[pageable]="true"
[sortable]="true"
[columnsresize]="true"
(onRowselect)="onRowSelect($event)">
</jqxGrid>
<p>Selected: {{ selected() }}</p>
<button type="button" (click)="exportToExcel()">Export to Excel</button>
The grid's rowselect event arrives as the (onRowselect) output. Updating the selected signal refreshes the paragraph without any extra change-detection code.
ng serve
Open http://localhost:4200/. Click a column header to sort, drag a column border to resize, and select a row to see its company name below the grid.
Next: Angular Grid getting started, grid data sources, or the same setup with a chart. Live examples: jQWidgets Angular demos.