Angular UI Components Documentation
The Angular DataTable displays a table of data and allows the user to sort, filter or edit it. This guide adds the Angular DataTable (jqxDataTable) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxdatatable 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxDataTableModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxDataTableModule } from 'jqwidgets-ng/jqxdatatable';
@Component({
selector: 'app-root',
imports: [jqxDataTableModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<jqxDataTable
[width]="getWidth()" [columns]="columns" [selectionMode]="'singleRow'"
[altRows]="true" [sortable]="true" [editable]="true">
<table id='table' border='1'>
<thead>
<tr>
<th align='left'>First Name</th>
<th align='left'>Last Name</th>
<th align='left'>Product</th>
<th align='right'>Price</th>
<th align='right'>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ian</td>
<td>Devling</td>
<td>Espresso Truffle</td>
<td>$1.75</td>
<td>8</td>
</tr>
<tr>
<td>Nancy</td>
<td>Wilson</td>
<td>Cappuccino</td>
<td>$5.00</td>
<td>3</td>
</tr>
<tr>
<td>Cheryl</td>
<td>Nodier</td>
<td>Caffe Americano</td>
<td>$2.50</td>
<td>4</td>
</tr>
<tr>
<td>Martin</td>
<td>Saavedra</td>
<td>Caramel Latte</td>
<td>$3.80</td>
<td>11</td>
</tr>
<tr>
<td>Guylene</td>
<td>Bjorn</td>
<td>Green Tea</td>
<td>$1.50</td>
<td>8</td>
</tr>
<tr>
<td>Andrew</td>
<td>Burke</td>
<td>Caffe Espresso</td>
<td>$3.00</td>
<td>2</td>
</tr>
<tr>
<td>Regina</td>
<td>Murphy</td>
<td>White Chocolate Mocha</td>
<td>$3.60</td>
<td>6</td>
</tr>
<tr>
<td>Michael</td>
<td>Murphy</td>
<td>Caramel Latte</td>
<td>$3.80</td>
<td>2</td>
</tr>
<tr>
<td>Petra</td>
<td>Bein</td>
<td>Caffe Americano</td>
<td>$2.50</td>
<td>7</td>
</tr>
<tr>
<td>Nancy</td>
<td>Nodier</td>
<td>Caffe Latte</td>
<td>$4.50</td>
<td>10</td>
</tr>
<tr>
<td>Peter</td>
<td>Devling</td>
<td>Green Tea</td>
<td>$1.50</td>
<td>1</td>
</tr>
<tr>
<td>Beate</td>
<td>Saylor</td>
<td>Espresso con Panna</td>
<td>$3.25</td>
<td>3</td>
</tr>
<tr>
<td>Shelley</td>
<td>Nodier</td>
<td>Peppermint Mocha Twist</td>
<td>$4.00</td>
<td>7</td>
</tr>
<tr>
<td>Nancy</td>
<td>Murphy</td>
<td>Peppermint Mocha Twist</td>
<td>$4.00</td>
<td>1</td>
</tr>
<tr>
<td>Lars</td>
<td>Wilson</td>
<td>Caffe Espresso</td>
<td>$3.00</td>
<td>11</td>
</tr>
</tbody>
</table>
</jqxDataTable>import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { jqxDataTableModule } from 'jqwidgets-ng/jqxdatatable';
@Component({
imports: [CommonModule, jqxDataTableModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
getWidth(): any {
if (document.body.offsetWidth < 850) {
return '90%';
}
return 850;
}
columns: any[] = [
{ text: 'First Name', dataField: 'First Name', width: 200 },
{ text: 'Last Name', dataField: 'Last Name', width: 200 },
{ text: 'Product', dataField: 'Product', width: 250 },
{
text: 'Unit Price',
dataField: 'Price',
width: 100,
align: 'right',
cellsAlign: 'right',
cellsFormat: 'c2'
},
{
text: 'Quantity',
dataField: 'Quantity',
width: 100,
align: 'right',
cellsAlign: 'right',
cellsFormat: 'n'
}
];
}
Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, bindingComplete: This event is triggered when the jqxDataTable binding is completed.
<jqxDataTable (onBindingComplete)="onBindingComplete($event)"></jqxDataTable>
onBindingComplete(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, refresh: Performs a layout and updates the HTML elements position and size.
<jqxDataTable #myDataTable></jqxDataTable>
import { Component, viewChild } from '@angular/core';
import { jqxDataTableModule, jqxDataTableComponent } from 'jqwidgets-ng/jqxdatatable';
@Component({
selector: 'app-root',
imports: [jqxDataTableModule],
templateUrl: './app.html'
})
export class App {
readonly myDataTable = viewChild.required<jqxDataTableComponent>('myDataTable');
run(): void {
this.myDataTable().refresh();
}
}