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: a grid in virtual mode, and a small Node.js API with Express that also serves the page.

You need Node.js 22 or later. Create a project for the API and install Express. npm pkg set type=module lets the server use import:
npm init -y
npm install express
npm pkg set type=module
The project has two files: server/server.js, the API, and public/server-side.html, the page. The page loads jQWidgets from the CDN, as in Bind the jQuery Grid to data, with the files for sorting, filtering and paging listed in Sorting, filtering and paging, except jqxcheckbox.js, which only the checked-list filter needs.
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. Absent when the grid is not sorted. |
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; a date range is two filters on the column, GREATER_THAN_OR_EQUAL and LESS_THAN_OR_EQUAL. |
The grid also sends recordstartindex and recordendindex (the same range as row numbers), groupscount, a filterGroups copy of the filters, and a _ parameter against caching. The API below does not need them. It 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.js. 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 { fileURLToPath } from 'node:url';
import express from 'express';
const app = express();
// The pages in public/ come from the same server as the API, so the grid can use a relative URL.
app.use(express.static(fileURLToPath(new URL('../public', import.meta.url))));
// 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)
});
});
const port = Number(process.env.PORT) || 3003;
app.listen(port, () => console.log(`Pages and API on http://localhost:${port}`));
express.static serves the public folder, so the page and the API come from the same address and the grid can use the relative URL /api/orders. The port is 3003, or the one in the PORT environment variable.
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, and root: 'rows' tells the adapter where the rows are. The source's sort and filter functions run when the user sorts or filters; they ask the server again with updatebounddata.
const grid = $('#grid');
// Every page, sort and filter change becomes a request to /api/orders with the grid's
// state in its query string.
const source = {
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) => {
source.totalrecords = data.total;
},
// Sorting and filtering happen on the server: ask it again.
sort: () => grid.jqxGrid('updatebounddata', 'sort'),
filter: () => grid.jqxGrid('updatebounddata', 'filter')
};
const adapter = new $.jqx.dataAdapter(source, {
loadError: (xhr, status, error) => {
document.getElementById('status').textContent = `Could not load the orders (${status}: ${error}).`;
}
});
grid.jqxGrid({
theme: 'fluent',
width: '100%',
height: 560,
source: adapter,
// With virtualmode, the grid shows the rows the server sent for the current page.
virtualmode: true,
rendergridrows: (params) => params.data,
pageable: true,
pagesize: 20,
pagesizeoptions: ['20', '50', '100'],
sortable: true,
filterable: true,
showfilterrow: true,
columns: [
{ 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' }
]
});
Save the whole page as public/server-side.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Orders</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/styles/jqx.fluent.css">
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcore.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdata.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxbuttons.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxscrollbar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxmenu.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxlistbox.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdropdownlist.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxcalendar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxdatetimeinput.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.selection.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.sort.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.filter.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqxgrid.pager.js"></script>
</head>
<body>
<main style="padding: 16px;">
<h1>Orders</h1>
<p id="status" role="alert"></p>
<div id="grid"></div>
</main>
<script type="module">
const grid = $('#grid');
// Every page, sort and filter change becomes a request to /api/orders with the grid's
// state in its query string.
const source = {
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) => {
source.totalrecords = data.total;
},
// Sorting and filtering happen on the server: ask it again.
sort: () => grid.jqxGrid('updatebounddata', 'sort'),
filter: () => grid.jqxGrid('updatebounddata', 'filter')
};
const adapter = new $.jqx.dataAdapter(source, {
loadError: (xhr, status, error) => {
document.getElementById('status').textContent = `Could not load the orders (${status}: ${error}).`;
}
});
grid.jqxGrid({
theme: 'fluent',
width: '100%',
height: 560,
source: adapter,
// With virtualmode, the grid shows the rows the server sent for the current page.
virtualmode: true,
rendergridrows: (params) => params.data,
pageable: true,
pagesize: 20,
pagesizeoptions: ['20', '50', '100'],
sortable: true,
filterable: true,
showfilterrow: true,
columns: [
{ 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' }
]
});
</script>
</body>
</html>
Start the server and open http://localhost:3003/server-side.html:
node server/server.js
The pager reads 1-20 of 10000. Click the Quantity header twice to sort from the largest order. Type ernst in the Customer filter: after a short pause the pager reads 1-20 of 1250, still sorted by quantity, and the next page continues the same orders. A range in the Date filter arrives as two date filters, such as 2026-02-01 and 2026-02-28. Each change is one request to /api/orders; open the browser's network panel to watch them. (Pressing Enter in a filter after typing sends the same request a second time.)