Vue 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: a Vue grid in virtual mode, and a small Node.js API with Express.

Use a Vite and Vue 3 app set up as in Add a Grid to a Vue 3 app, 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.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 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(3005, () => console.log('API on http://localhost:3005'));
Start it in its own terminal with node server/server.js. The create-vue template's package.json has "type": "module", which lets the file use import.
The page and the API run on different ports. Vite's proxy forwards requests to /api, so the grid can use a relative URL. Add the server section to vite.config.ts, next to the two jqwidgets-scripts settings:
import vue from '@vitejs/plugin-vue';
import { defineConfig, type Plugin } from 'vite';
// Before jqwidgets-scripts 27.1.0: globalize.js, which the Grid component imports, hands its code
// `this` as the window. In an ES module `this` is undefined, and the dev server serves the file
// as one, so `npm run dev` stops with "Cannot set properties of undefined (setting 'Globalize')".
// (The production build is not affected.) This passes the window instead; with 27.1.0 it changes nothing.
const globalizeWindow: Plugin = {
name: 'jqwidgets-globalize-window',
transform(code, id) {
if (id.includes('jqwidgets-scripts/jqwidgets/globalization/globalize.js')) {
return code.replace(/\}\(this\)\);/, '}(window));');
}
}
};
export default defineConfig({
plugins: [vue(), globalizeWindow],
server: {
// Requests to /api go to the Express server during development.
proxy: { '/api': 'http://localhost:3005' }
},
// Some jqWidgets themes still carry Internet Explorer CSS hacks (*zoom: 1; in 27.1.0 only light-ie
// and dark-ie), which Vite's CSS minifier rejects; errorRecovery drops those lines instead of
// failing the build.
css: { lightningcss: { errorRecovery: true } }
});
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, through the template ref grid. A failed request calls the adapter's loadError, which puts the message in a ref, above the grid.
The adapter is made once, when the component is set up, and is a plain constant, not a ref. Every prop of JqxGrid is a constant too, so the error message re-renders the component but not the grid: the grid sends no new request and keeps its page, sort and filters.
<script setup lang="ts">
import { ref } from 'vue';
import JqxGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxgrid.vue';
// Defined globally by the jQWidgets core, which the Grid component imports.
declare const jqx: any;
interface OrdersPage {
total: number;
rows: unknown[];
}
// The grid methods this component calls.
interface GridMethods {
updatebounddata: (type?: string) => void;
}
const 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' }
];
// With virtualmode, the grid shows the rows the server sent for the current page.
const rendergridrows = (params: { data: unknown[] }) => params.data;
const pagesizeoptions = ['20', '50', '100'];
const grid = ref<GridMethods | null>(null);
const error = ref<string | null>(null);
// One source for the grid's life. Every page, sort and filter change becomes a request to
// /api/orders with the grid's state in its query string.
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: () => grid.value?.updatebounddata('sort'),
filter: () => grid.value?.updatebounddata('filter')
};
const source = new jqx.dataAdapter(settings, {
loadError: (_xhr: XMLHttpRequest, status: string, message: string) => {
error.value = `${status}: ${message}`;
}
});
</script>
<template>
<main style="padding: 16px">
<h1>Orders</h1>
<p v-if="error" role="alert">Could not load the orders ({{ error }}).</p>
<!-- Every prop is a constant: the error message re-renders this component, not the grid. -->
<JqxGrid
ref="grid"
width="100%"
:height="560"
theme="material-purple"
:source="source"
:columns="columns"
:virtualmode="true"
:rendergridrows="rendergridrows"
:pageable="true"
:pagesize="20"
:pagesizeoptions="pagesizeoptions"
:sortable="true"
:filterable="true"
:showfilterrow="true"
/>
</main>
</template>
The adapter makes the requests itself, with XMLHttpRequest. To load the pages with fetch or a client library instead, give the adapter a loadServerData function, as the Supabase and GraphQL tutorials do.
With the API and npm run dev 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 continues the same orders. Each of these is one request to /api/orders; open the browser's network panel to watch them.