Angular UI Components Documentation
With server-side processing the grid asks the server for one page at a time, and the server sorts and filters before it pages. The browser never holds the whole table, so it works the same with ten thousand rows or ten million. This tutorial builds both halves: an Angular grid in virtual mode, and a small Node.js API with Express, which the Angular CLI's dev server reaches through a proxy.

Use an Angular CLI app set up as in Angular CLI with jQWidgets, and install Express for the API:
npm install express
In virtual mode, every page change, sort and filter becomes a request to the source's url, with the grid's state in the query string:
| Parameter | Meaning |
|---|---|
pagenum, pagesize | The page (from 0) and the rows per page. |
sortdatafield, sortorder | The column to sort by, and asc or desc. |
filterscount | How many filters there are. |
filterdatafield0, filtercondition0, filtervalue0, filteroperator0, … | For each filter: the column, the condition (CONTAINS, EQUAL, GREATER_THAN and so on), the value, and how it joins the previous filter on the same column (0 = and, 1 = or). Dates arrive in the format of their data field, here yyyy-MM-dd. |
The server answers with the matching rows of the requested page and the number of matching rows, so the pager knows how many pages there are.
Save this as server/server.mjs. The data is generated in memory to keep the example self-contained; a real API runs the same filtering, sorting and paging in its database query. Column names and conditions are checked against lists before they are used (with Object.hasOwn, so a name such as constructor is not taken from the object's prototype), and the page size is kept in a range: nothing in a request reaches other data.
import express from 'express';
const app = express();
// Sample data: 10,000 orders kept in memory. A real API runs the same paging, sorting and
// filtering in its database query.
const customers = ['Alfreds Futterkiste', 'Bon app', 'Ernst Handel', 'Frankenversand', 'Königlich Essen', 'Que Delícia', 'Wartian Herkku', 'Wilman Kala'];
const products = ['Chai', 'Chang', 'Ikura', 'Konbu', 'Tofu', 'Pavlova', 'Gnocchi', 'Mascarpone'];
const day = 24 * 60 * 60 * 1000;
const orders = Array.from({ length: 10000 }, (_, i) => ({
id: i + 1,
customer: customers[(i * 7) % customers.length],
product: products[(i * 5) % products.length],
quantity: 1 + ((i * 13) % 50),
price: Math.round((2 + ((i * 37) % 45) + ((i * 11) % 100) / 100) * 100) / 100,
date: new Date(Date.UTC(2026, 0, 1) + ((i * 3) % 270) * day).toISOString().slice(0, 10)
}));
// The columns the grid may sort and filter by. Any other field name in a request is ignored,
// so a request cannot reach other data.
const COLUMNS = { customer: 'string', product: 'string', quantity: 'number', price: 'number', date: 'date' };
// The conditions the grid's filters send, for each type of column.
const TEST = {
CONTAINS: (a, b) => String(a).toLowerCase().includes(String(b).toLowerCase()),
DOES_NOT_CONTAIN: (a, b) => !String(a).toLowerCase().includes(String(b).toLowerCase()),
STARTS_WITH: (a, b) => String(a).toLowerCase().startsWith(String(b).toLowerCase()),
ENDS_WITH: (a, b) => String(a).toLowerCase().endsWith(String(b).toLowerCase()),
EQUAL: (a, b) => (typeof a === 'string' ? a.toLowerCase() === String(b).toLowerCase() : a === b),
NOT_EQUAL: (a, b) => (typeof a === 'string' ? a.toLowerCase() !== String(b).toLowerCase() : a !== b),
LESS_THAN: (a, b) => a < b,
LESS_THAN_OR_EQUAL: (a, b) => a <= b,
GREATER_THAN: (a, b) => a > b,
GREATER_THAN_OR_EQUAL: (a, b) => a >= b
};
// A filter value of the column's type. Dates arrive as yyyy-MM-dd, the format the grid's
// date field declares, and compare as text.
function typed(type, value) {
if (type === 'number') return Number(value);
if (type === 'date') return String(value).slice(0, 10);
return String(value);
}
// The grid sends filterscount and, for each filter i: filterdatafield<i>, filtercondition<i>,
// filtervalue<i> and filteroperator<i> (how it joins the previous filter on the same column:
// 0 = and, 1 = or). Filters on different columns all have to match.
function filterRows(rows, query) {
const count = Math.min(Number(query.filterscount) || 0, 20);
const byColumn = new Map();
for (let i = 0; i < count; i++) {
const field = query[`filterdatafield${i}`];
const test = TEST[query[`filtercondition${i}`]];
if (!Object.hasOwn(COLUMNS, field) || !Object.hasOwn(TEST, query[`filtercondition${i}`])) continue;
const value = typed(COLUMNS[field], query[`filtervalue${i}`]);
if (!byColumn.has(field)) byColumn.set(field, []);
byColumn.get(field).push({ test, value, or: query[`filteroperator${i}`] === '1' });
}
if (!byColumn.size) return rows;
return rows.filter((row) =>
[...byColumn].every(([field, filters]) =>
filters.reduce((ok, f, i) => {
const hit = f.test(row[field], f.value);
return i === 0 ? hit : f.or ? ok || hit : ok && hit;
}, true)
)
);
}
app.get('/api/orders', (req, res) => {
const query = req.query;
let rows = filterRows(orders, query);
// Sorting: sortdatafield and sortorder (asc or desc).
const field = query.sortdatafield;
if (Object.hasOwn(COLUMNS, field)) {
const dir = query.sortorder === 'desc' ? -1 : 1;
rows = [...rows].sort((a, b) => (a[field] < b[field] ? -dir : a[field] > b[field] ? dir : 0));
}
// Paging: pagenum (from 0) and pagesize, kept in a sensible range.
const pagesize = Math.min(Math.max(Number(query.pagesize) || 10, 1), 100);
const pagenum = Math.max(Number(query.pagenum) || 0, 0);
res.json({
total: rows.length,
rows: rows.slice(pagenum * pagesize, (pagenum + 1) * pagesize)
});
});
app.listen(3002, () => console.log('API on http://localhost:3002'));
Start it in its own terminal with node server/server.mjs. The file name ends in .mjs because the package.json of an Angular CLI project has no "type": "module"; the extension tells Node.js that the file uses import.
The page and the API run on different ports. The Angular CLI's dev server forwards requests through a proxy, so the grid can use a relative URL. Save this as proxy.conf.json next to angular.json:
{
"/api": {
"target": "http://localhost:3002",
"secure": false
}
}
and point the serve target of angular.json at it, then restart ng serve:
"serve": {
"builder": "@angular/build:dev-server",
"options": {
"proxyConfig": "proxy.conf.json"
},
ng serve --proxy-config proxy.conf.json does the same for one run. In production, serve the built app and the API from the same site, or point the URL at the API's address.
virtualmode tells the grid that the data comes a page at a time, and rendergridrows returns the rows the server sent. The source's beforeprocessing reads the total from each answer. Its sort and filter functions run when the user sorts or filters; they ask the server again with updatebounddata.
import { Component, signal, viewChild } from '@angular/core';
import { jqxGridComponent, jqxGridModule } from 'jqwidgets-ng/jqxgrid';
interface OrdersPage {
total: number;
rows: unknown[];
}
@Component({ selector: 'app-root', imports: [jqxGridModule], templateUrl: './app.html' })
export class App {
readonly grid = viewChild.required<jqxGridComponent>('grid');
readonly error = signal<string | null>(null);
// One source for the component's life. Every page, sort and filter change becomes a
// request to /api/orders with the grid's state in its query string.
readonly source = this.createSource();
readonly columns: jqwidgets.GridColumn[] = [
{ text: 'Order', datafield: 'id', width: 80, filterable: false },
{ text: 'Customer', datafield: 'customer', width: 200 },
{ text: 'Product', datafield: 'product', width: 140 },
{
text: 'Quantity',
datafield: 'quantity',
width: 110,
cellsalign: 'right',
align: 'right',
filtertype: 'number'
},
{
text: 'Price',
datafield: 'price',
width: 110,
cellsalign: 'right',
align: 'right',
cellsformat: 'c2',
filtertype: 'number'
},
{ text: 'Date', datafield: 'date', cellsformat: 'yyyy-MM-dd', filtertype: 'range' }
];
readonly pagesizeoptions = ['20', '50', '100'];
// With virtualmode, the grid shows the rows the server sent for the current page.
readonly rendergridrows = (params: { data: unknown[] }) => params.data;
private createSource() {
const settings = {
url: '/api/orders',
datatype: 'json',
root: 'rows',
id: 'id',
datafields: [
{ name: 'id', type: 'number' },
{ name: 'customer', type: 'string' },
{ name: 'product', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'price', type: 'number' },
{ name: 'date', type: 'date', format: 'yyyy-MM-dd' }
],
totalrecords: 0,
// The total of matching rows, so the pager knows how many pages there are.
beforeprocessing: (data: OrdersPage) => {
settings.totalrecords = data.total;
},
// Sorting and filtering happen on the server: ask it again.
sort: () => this.grid().updatebounddata('sort'),
filter: () => this.grid().updatebounddata('filter')
};
return new jqx.dataAdapter(settings, {
loadError: (_xhr: XMLHttpRequest, status: string, error: string) =>
this.error.set(`${status}: ${error}`)
});
}
}
<h1>Orders</h1>
@if (error(); as message) {
<p role="alert">Could not load the orders ({{ message }}).</p>
}
<jqxGrid #grid
[theme]="'fluent'"
[width]="'100%'"
[height]="560"
[source]="source"
[columns]="columns"
[virtualmode]="true"
[rendergridrows]="rendergridrows"
[pageable]="true"
[pagesize]="20"
[pagesizeoptions]="pagesizeoptions"
[sortable]="true"
[filterable]="true"
[showfilterrow]="true">
</jqxGrid>
The source is a field, made once by createSource(). Its sort and filter functions are arrow functions, so this.grid() is the component's signal query; they run only after the grid exists. The adapter sends its requests with its own XMLHttpRequest, not with Angular's HttpClient, so HttpClient interceptors do not see them. When a request fails, loadError sets the error signal and the page shows, for example, Could not load the orders (error: Internal Server Error).
With the API and ng serve running, the pager reads 1-20 of 10000. Click the Quantity header twice to sort from the largest order. Type ernst in the Customer filter and press Enter: the pager reads 1-20 of 1250, still sorted by quantity, and the next page (21-40 of 1250) continues the same orders. Each of these is one request to /api/orders; open the browser's network panel to watch them.