Vue UI Components Documentation
This tutorial puts 100,000 rows in a Vue grid and moves twenty of their prices every second, while the rest of the component keeps re-rendering. It covers the three things that keep such a grid fast: let it virtualize, keep Vue from re-rendering it, and change cells instead of replacing the data.

Use a Vite and Vue 3 app set up as in Add a Grid to a Vue 3 app.
With a fixed height, the grid creates elements only for the rows in view (16 here) and reuses them as you scroll, whatever the number of rows. autoheight makes the grid as tall as its rows, so it has to create every row of the page: keep it for small tables or with paging.
The rows are made once, in a plain <script> block next to <script setup>. That block runs when the module is first imported; <script setup> runs again for every instance of the component, which would build the 100,000 rows again each time the component is mounted. They are not a ref either: Vue would wrap every row in a reactive proxy.
<script lang="ts">
// Defined globally by the jQWidgets core, which the Grid component imports. (Declared here:
// a declaration cannot go in <script setup> when the component also has a plain <script>.)
declare const jqx: any;
// A plain <script> block runs once, when the module is first imported. The 100,000 rows are
// made here, not in <script setup>, which runs again for every instance of the component.
interface Quote {
id: number;
symbol: string;
exchange: string;
price: number;
change: number;
volume: number;
}
const ROWS = 100_000;
const exchanges = ['NYSE', 'NASDAQ', 'LSE', 'XETRA', 'TSE'];
const quotes: Quote[] = Array.from({ length: ROWS }, (_, i) => ({
id: i + 1,
symbol: `SYM${String(i + 1).padStart(6, '0')}`,
exchange: exchanges[i % exchanges.length],
price: Math.round((10 + ((i * 7919) % 99000) / 100) * 100) / 100,
change: 0,
volume: (i * 104729) % 5_000_000
}));
</script>
The component has a clock that updates a ref every second, and each tick re-renders the component. Each re-render of the Grid component applies its props again (jqwidgets-scripts 27.1.0 the ones whose value changed, earlier versions all of them), and applying source binds all 100,000 rows again. Vue re-renders a child only when one of its props has a new value, so every prop of JqxGrid is a constant:
<template>
<main style="padding: 16px">
<h1>Quotes</h1>
<p style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center">
<span>{{ ROWS.toLocaleString('en-US') }} rows · {{ now.toLocaleTimeString() }}</span>
<button type="button" @click="live = !live">{{ live ? 'Stop live updates' : 'Start live updates' }}</button>
<span aria-live="off">{{ lastUpdate }}</span>
</p>
<!-- A fixed height: the grid then creates elements only for the rows in view and reuses
them as you scroll. (autoheight would create one for every row.) -->
<JqxGrid
ref="grid"
width="100%"
:height="520"
theme="material-purple"
:source="source"
:columns="columns"
:sortable="true"
:filterable="true"
:columnsresize="true"
/>
</main>
</template>
// The clock re-renders the component every second. The grid's props never change, so the
// grid itself is not touched.
let clock = 0;
onMounted(() => {
clock = window.setInterval(() => {
now.value = new Date();
}, 1000);
});
onUnmounted(() => window.clearInterval(clock));
Check the same in your own components: source, columns and every other object or array prop is a constant of the script, and every event handler a function declared in it. A ref, a computed, or an expression such as :columns="makeColumns()" is a new value whenever it changes, and the grid binds again.
To change a few values, set the cells: setcellvalue for each changed cell, between beginupdate() and endupdate() so that the grid draws once. getrowboundindexbyid finds a row's index from its id. Measured in this example, twenty rows take about 10 to 20 milliseconds. Twenty updaterow calls, one per row, took seconds, and a new source would bind all the rows again.
// Twenty of the watched rows change each second. Only the changed cells are set, inside one
// beginupdate/endupdate pair, so the grid draws once for all of them. (Measured with
// 100,000 rows: about 20 ms. updaterow for each row took over a second; a new source
// would bind all 100,000 rows again.)
function tick() {
const g = grid.value;
if (!g) {
return;
}
const started = performance.now();
g.beginupdate();
for (let n = 0; n < 20; n++) {
const id = String(1 + Math.floor(Math.random() * WATCHED));
const index = g.getrowboundindexbyid(id);
const change = Math.round((Math.random() - 0.5) * 200) / 100;
g.setcellvalue(index, 'price', Math.max(1, g.getcellvalue(index, 'price') + change));
g.setcellvalue(index, 'change', change);
}
g.endupdate();
lastUpdate.value = `20 rows updated in ${(performance.now() - started).toFixed(1)} ms`;
}
A watcher on live starts the feed. Its onCleanup stops it when live goes off, and also when the component is unmounted, since a watcher made in <script setup> stops with its component:
// The feed runs while live is on; onCleanup stops it when live goes off or the component goes.
watch(live, (on, _old, onCleanup) => {
if (!on) {
return;
}
const timer = window.setInterval(tick, 1000);
onCleanup(() => window.clearInterval(timer));
});
The Change column colours itself with cellclassname. Save the two classes as src/quotes.css:
.up { color: #15803d !important; }
.down { color: #b91c1c !important; }
<script lang="ts">
// Defined globally by the jQWidgets core, which the Grid component imports. (Declared here:
// a declaration cannot go in <script setup> when the component also has a plain <script>.)
declare const jqx: any;
// A plain <script> block runs once, when the module is first imported. The 100,000 rows are
// made here, not in <script setup>, which runs again for every instance of the component.
interface Quote {
id: number;
symbol: string;
exchange: string;
price: number;
change: number;
volume: number;
}
const ROWS = 100_000;
const exchanges = ['NYSE', 'NASDAQ', 'LSE', 'XETRA', 'TSE'];
const quotes: Quote[] = Array.from({ length: ROWS }, (_, i) => ({
id: i + 1,
symbol: `SYM${String(i + 1).padStart(6, '0')}`,
exchange: exchanges[i % exchanges.length],
price: Math.round((10 + ((i * 7919) % 99000) / 100) * 100) / 100,
change: 0,
volume: (i * 104729) % 5_000_000
}));
</script>
<script setup lang="ts">
import { onMounted, onUnmounted, ref, watch } from 'vue';
import JqxGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxgrid.vue';
import './quotes.css';
// The grid methods this component calls.
interface GridMethods {
beginupdate: () => void;
endupdate: () => void;
getrowboundindexbyid: (id: string) => number;
getcellvalue: (rowindex: number, datafield: string) => number;
setcellvalue: (rowindex: number, datafield: string, value: unknown) => void;
}
// The live feed moves the prices of the first 200 symbols, the ones in view.
const WATCHED = 200;
const source = new jqx.dataAdapter({
localdata: quotes,
datatype: 'array',
id: 'id',
datafields: [
{ name: 'id', type: 'number' },
{ name: 'symbol', type: 'string' },
{ name: 'exchange', type: 'string' },
{ name: 'price', type: 'number' },
{ name: 'change', type: 'number' },
{ name: 'volume', type: 'number' }
]
});
const columns = [
{ text: 'Symbol', datafield: 'symbol', width: 140 },
{ text: 'Exchange', datafield: 'exchange', width: 110 },
{ text: 'Price', datafield: 'price', width: 120, cellsformat: 'f2', cellsalign: 'right', align: 'right' },
{
text: 'Change', datafield: 'change', width: 110, cellsformat: 'f2', cellsalign: 'right', align: 'right',
cellclassname: (_row: number, _field: string, value: number) => (value > 0 ? 'up' : value < 0 ? 'down' : '')
},
{ text: 'Volume', datafield: 'volume', cellsformat: 'n0', cellsalign: 'right', align: 'right' }
];
const grid = ref<GridMethods | null>(null);
const live = ref(false);
const lastUpdate = ref('');
const now = ref(new Date());
// The clock re-renders the component every second. The grid's props never change, so the
// grid itself is not touched.
let clock = 0;
onMounted(() => {
clock = window.setInterval(() => {
now.value = new Date();
}, 1000);
});
onUnmounted(() => window.clearInterval(clock));
// Twenty of the watched rows change each second. Only the changed cells are set, inside one
// beginupdate/endupdate pair, so the grid draws once for all of them. (Measured with
// 100,000 rows: about 20 ms. updaterow for each row took over a second; a new source
// would bind all 100,000 rows again.)
function tick() {
const g = grid.value;
if (!g) {
return;
}
const started = performance.now();
g.beginupdate();
for (let n = 0; n < 20; n++) {
const id = String(1 + Math.floor(Math.random() * WATCHED));
const index = g.getrowboundindexbyid(id);
const change = Math.round((Math.random() - 0.5) * 200) / 100;
g.setcellvalue(index, 'price', Math.max(1, g.getcellvalue(index, 'price') + change));
g.setcellvalue(index, 'change', change);
}
g.endupdate();
lastUpdate.value = `20 rows updated in ${(performance.now() - started).toFixed(1)} ms`;
}
// The feed runs while live is on; onCleanup stops it when live goes off or the component goes.
watch(live, (on, _old, onCleanup) => {
if (!on) {
return;
}
const timer = window.setInterval(tick, 1000);
onCleanup(() => window.clearInterval(timer));
});
</script>
<template>
<main style="padding: 16px">
<h1>Quotes</h1>
<p style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center">
<span>{{ ROWS.toLocaleString('en-US') }} rows · {{ now.toLocaleTimeString() }}</span>
<button type="button" @click="live = !live">{{ live ? 'Stop live updates' : 'Start live updates' }}</button>
<span aria-live="off">{{ lastUpdate }}</span>
</p>
<!-- A fixed height: the grid then creates elements only for the rows in view and reuses
them as you scroll. (autoheight would create one for every row.) -->
<JqxGrid
ref="grid"
width="100%"
:height="520"
theme="material-purple"
:source="source"
:columns="columns"
:sortable="true"
:filterable="true"
:columnsresize="true"
/>
</main>
</template>
The grid opens at once with 100,000 rows, and scrolling, sorting and filtering work on all of them. Start live updates moves twenty of the first two hundred prices each second, and the line next to the button gives the time each update took.