VibeFox JS Grid — Demo
Avvio rapido
HTML semplice
Colonne con tipo di dato, una colonna con caselle di controllo, una colonna heatmap con una somma nella riga dei totali, la barra di stato e una ricerca rapida con la sintassi delle query. Fare clic su un'intestazione per ordinare, fare doppio clic su un nome per modificarlo.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 300,
columns: [
{ field: 'name', header: 'Name', editable: true },
{ field: 'city', header: 'City' },
{ field: 'salary', header: 'Salary', type: 'number', aggregate: 'sum', heatmap: true },
{ field: 'joined', header: 'Joined', type: 'date' },
{ field: 'active', header: 'Active', type: 'boolean', editable: true },
],
selection: { mode: 'row', multi: true, checkbox: true },
footer: true,
statusBar: true,
});
grid.setQuickFilter('salary>60000');
grid.setSelection([3]);Colonne
Definizione delle colonne
Una colonna del nome fissata, colonne numeriche, di data, a selezione e booleane, ciascuna con i propri formati e il proprio allineamento.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: [
{ field: 'name', header: 'Name', width: 160, pin: 'left' },
{ field: 'dept', header: 'Department', type: 'select', options: ['Sales', 'Engineering', 'Support'] },
{ field: 'salary', header: 'Salary', type: 'number', decimals: 2 },
{ field: 'joined', header: 'Joined', type: 'date', dateFormat: 'DD.MM.YYYY' },
{ field: 'active', header: 'Active', type: 'boolean', align: 'center' },
{ field: 'rating', header: 'Rating', type: 'number', formatter: (v) => '★'.repeat(v) },
],
});Gruppi di colonne (intestazioni su più livelli)
Due livelli di gruppi di colonne sopra le intestazioni delle colonne; "Employee" è comprimibile: fare clic sul suo pulsante di espansione/compressione per nascondere o mostrare la colonna City.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: [
{ header: 'Employee', groupId: 'emp', collapsible: true, children: [
{ field: 'name', header: 'Name' },
{ field: 'city', header: 'City', groupShow: 'open' },
] },
{ header: 'Work', children: [
'dept',
{ header: 'Pay', children: [{ field: 'salary', type: 'number' }, { field: 'rating', type: 'number' }] },
] },
],
});Pannello degli strumenti delle colonne e pannello di raggruppamento
Il pannello delle colonne a destra (mostra / nascondi, fissa, riordina) e il pannello di raggruppamento sopra la griglia con un livello di raggruppamento. Trascinare un'intestazione di colonna nel pannello di raggruppamento per aggiungere un livello.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 360,
columns: ['name', 'dept', 'city', { field: 'salary', type: 'number', aggregate: 'avg' }],
sideBar: { width: 220 },
groupPanel: true,
groupBy: ['dept'],
});Renderer e editor delle celle
Renderer
Un renderer HTML per un badge di stato e un renderer del ciclo di vita che monta una barra di avanzamento in ogni cella visibile.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: [
'name',
{ field: 'active', header: 'Status', renderer: (p) => p.value
? '<b style="color:#15803d">● active</b>' : '<span style="color:#b91c1c">● inactive</span>' },
{ field: 'rating', header: 'Rating', width: 220, renderer: {
mount(el, p) { const bar = document.createElement('progress'); bar.max = 5; bar.value = p.value; el.append(bar); return bar; },
update(el, p, bar) { bar.value = p.value; },
} },
],
});Editor
L'editor di selezione avanzata integrato della colonna City, aperto con beginEdit(). Scegliere una città, poi fare doppio clic su un'altra cella della colonna City.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 360,
editable: true,
columns: ['name', { field: 'city', header: 'City', width: 200, editor: 'richSelect',
editorOptions: { values: ['Berlin', 'London', 'Madrid', 'Paris', 'Rome', 'Vienna'] } }, 'dept'],
});
grid.beginEdit(2, 'city');Righe e dati
Dati ad albero
Righe annidate con pulsanti di espansione / compressione e rientri; fare clic su un pulsante per comprimere un ramo.
const grid = VibeFoxJSGrid.createGrid('#app', {
tree: true,
rowId: 'id',
height: 300,
columns: [{ field: 'name', header: 'Region', width: 240 }, { field: 'staff', type: 'number', aggregate: 'sum' }],
data: [
{ id: 1, name: 'Europe', staff: 120, children: [
{ id: 2, name: 'Germany', staff: 70, children: [{ id: 3, name: 'Berlin', staff: 50 }, { id: 4, name: 'Munich', staff: 20 }] },
{ id: 5, name: 'France', staff: 50, children: [{ id: 6, name: 'Paris', staff: 50 }] },
] },
{ id: 7, name: 'America', staff: 40, children: [{ id: 8, name: 'Boston', staff: 40 }] },
],
});Righe fissate e riga per l'inserimento
La riga per l'inserimento fissata in alto e una riga dei totali fissata in basso (calcolata dalle righe filtrate). Digitare un nome e uno stipendio nella riga in alto e premere Enter.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 360,
editable: true,
columns: ['name', 'city', { field: 'salary', type: 'number' }],
newRow: { position: 'top' },
pinnedBottomRows: ({ rows }) => [{ name: 'Total', salary: rows.reduce((s, r) => s + r.salary, 0) }],
});Master / detail
Una riga master espansa con una griglia annidata dei suoi ordini; fare clic sul pulsante di espansione/compressione di Globex per aprire anche i suoi ordini.
const grid = VibeFoxJSGrid.createGrid('#app', {
rowId: 'id',
height: 380,
columns: ['customer', 'city'],
data: [
{ id: 1, customer: 'ACME', city: 'Berlin', orders: [
{ date: '2026-10-01', item: 'Laptop', total: 1200 }, { date: '2026-10-12', item: 'Monitor', total: 300 }] },
{ id: 2, customer: 'Globex', city: 'Paris', orders: [{ date: '2026-09-28', item: 'Phone', total: 650 }] },
{ id: 3, customer: 'Initech', city: 'London', orders: [] },
],
masterDetail: {
rows: 'orders',
grid: { columns: ['date', 'item', { field: 'total', type: 'number' }], height: 130 },
isMaster: (row) => row.orders.length > 0,
},
});
grid.expandDetail(1);Celle unite
Valori uguali della colonna Department uniti in una sola cella (rowSpan: true).
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
rows.sort((a, b) => a.dept.localeCompare(b.dept));
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: [{ field: 'dept', header: 'Department', rowSpan: true }, 'name', 'city'],
});Paginazione e barra di stato
Pagine di 10 righe con il paginatore e la barra di stato; cambiare pagina o la dimensione della pagina nel paginatore.
const rows = Array.from({ length: 95 }, (_, i) => ({ id: i + 1, item: 'Item ' + (i + 1), qty: (i * 37) % 50 }));
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 400,
columns: ['id', 'item', { field: 'qty', type: 'number' }],
pagination: { pageSize: 10, pageSizes: [10, 25, 50] },
statusBar: true,
});
grid.setPage(2);Modifica e tracciamento delle modifiche
Tracciamento delle modifiche
Le celle modificate ricevono un contrassegno; la barra di stato conta le modifiche non salvate. Fare doppio clic su una cella e modificarne il valore per aggiungerne un'altra.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
editable: true,
statusBar: true,
columns: ['name', 'city', { field: 'salary', type: 'number' }],
});
grid.setCellValue(2, 'salary', 61000);
grid.setCellValue(4, 'city', 'Dublin');
grid.setCellValue(6, 'salary', 54000);
console.log(grid.getChanges());Maniglia di riempimento
Un intervallo di celle selezionato con la maniglia di riempimento nell'angolo (modalità di selezione delle celle). Trascinare la maniglia verso il basso per continuare la serie 1, 2, 3…
const rows = Array.from({ length: 8 }, (_, i) => ({ id: i + 1, day: i < 3 ? 'Monday' : '', week: i < 2 ? i + 1 : null, task: 'Task ' + (i + 1) }));
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 300,
editable: true,
selection: { mode: 'cell' },
columns: ['task', 'day', { field: 'week', type: 'number' }],
});
grid.setCellRange({ from: { id: 1, field: 'week' }, to: { id: 2, field: 'week' } });Selezione e appunti
Selezione delle righe tramite la colonna delle caselle di controllo; tre righe sono selezionate. Fare clic sulle caselle di controllo per modificare la selezione.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: ['name', 'dept', 'city'],
selection: { mode: 'row', multi: true, checkbox: true },
statusBar: true,
});
grid.setSelection([1, 3, 4]);Ordinamento, filtro e ricerca
Ordinamento
Ordinamento per due colonne: reparto crescente, poi stipendio decrescente. Fare clic su un'intestazione per ordinare per quella colonna.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: ['name', 'dept', { field: 'salary', type: 'number' }],
});
grid.setSort([{ field: 'dept', dir: 'asc' }, { field: 'salary', dir: 'desc' }]);Filtri nelle intestazioni
La colonna City è filtrata su Berlin e Paris. Fare clic sul pulsante del filtro dell'intestazione City per aprirne il menu: ordinamento, due condizioni e l'elenco dei valori.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 460,
columns: ['name', 'city', { field: 'salary', type: 'number' }],
});
grid.setFilter('city', { type: 'set', values: ['Berlin', 'Paris'] });Costruttore di filtri
Il costruttore di filtri con un gruppo OR annidato.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 460,
columns: ['name', 'city', { field: 'salary', type: 'number' }, { field: 'active', type: 'boolean' }],
});
grid.setFilterModel({ op: 'and', rules: [
{ field: 'city', op: 'equals', value: 'Berlin' },
{ op: 'or', rules: [{ field: 'salary', op: '>', value: 80000 }, { field: 'active', op: 'isTrue' }] },
] });
grid.showFilterBuilder();Ricerca rapida e sintassi delle query
La ricerca rapida salary>60000 city:berlin mantiene le righe che corrispondono a entrambi i termini.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 240,
statusBar: true,
columns: ['name', 'city', { field: 'salary', type: 'number' }],
});
grid.setQuickFilter('salary>60000 city:berlin');Raggruppamento, totali e pivot
Raggruppamento delle righe
Righe raggruppate per reparto, con lo stipendio medio nelle righe di gruppo e nella riga dei totali; fare clic sul pulsante di un gruppo per comprimerlo.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 420,
columns: ['name', 'dept', 'city', { field: 'salary', type: 'number', aggregate: 'avg' }],
groupBy: ['dept'],
footer: true,
});Modalità pivot
Vendite per regione e città (righe) e trimestre (colonne) con subtotali e totali generali.
const sales = [];
const regions = { Europe: ['Berlin', 'Paris', 'Madrid'], America: ['Boston', 'Toronto'] };
let n = 0;
for (const [region, cities] of Object.entries(regions)) {
for (const city of cities) {
for (let q = 0; q < 4; q++) {
n++;
sales.push({ id: n, region, city, quarter: 'Q' + (q + 1), product: n % 2 ? 'Laptops' : 'Phones', amount: 1000 + ((n * 7919) % 9000) });
}
}
}
const grid = VibeFoxJSGrid.createGrid('#app', {
data: sales,
rowId: 'id',
height: 360,
pivot: {
rows: ['region', 'city'],
columns: ['quarter'],
values: [{ field: 'amount', aggregate: 'sum', header: 'Sales' }],
},
});Formule
Colonne calcolate
La colonna Total calcola =[@price]*[@qty] per ogni riga.
const grid = VibeFoxJSGrid.createGrid('#app', {
rowId: 'id',
height: 260,
footer: true,
data: [
{ id: 1, item: 'Laptop', price: 1200, qty: 3 },
{ id: 2, item: 'Monitor', price: 300, qty: 5 },
{ id: 3, item: 'Keyboard', price: 45, qty: 12 },
{ id: 4, item: 'Mouse', price: 25, qty: 20 },
],
columns: ['item', { field: 'price', type: 'number' }, { field: 'qty', type: 'number' },
{ field: 'total', header: 'Total', type: 'number', formula: '=[@price]*[@qty]', aggregate: 'sum' }],
});Formule nelle celle
Celle con formule; l'editor dell'ultima cella mostra la formula con i riferimenti colorati.
const grid = VibeFoxJSGrid.createGrid('#app', {
rowId: 'id',
height: 300,
editable: true,
formulas: true,
data: [
{ id: 1, label: 'January', value: 120 },
{ id: 2, label: 'February', value: 150 },
{ id: 3, label: 'March', value: 90 },
{ id: 4, label: 'Total', value: '=SUM(B1:B3)' },
{ id: 5, label: 'Average', value: '=ROUND(AVERAGE(B1:B3),1)' },
],
columns: ['label', { field: 'value', type: 'number', width: 220 }],
});
grid.beginEdit(4, 'value');Formattazione condizionale
Una regola di evidenziazione, barre dei dati, una scala a tre colori e un set di icone.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 320,
columns: ['name', 'city', { field: 'salary', type: 'number', width: 180 }, { field: 'rating', type: 'number' },
{ field: 'growth', type: 'number', formula: '=[@rating]*10-25' }],
conditionalFormats: [
{ fields: ['city'], type: 'text', op: 'equals', value: 'Berlin', style: { preset: 'good' } },
{ fields: ['salary'], type: 'dataBar', gradient: true },
{ fields: ['growth'], type: 'colorScale', colors: ['#f8696b', '#ffeb84', '#63be7b'] },
{ fields: ['rating'], type: 'iconSet', icons: 'stars3' },
],
});Sparkline e grafici degli intervalli
Celle sparkline
Sparkline a linea, a colonne e a vittorie / sconfitte da quattro campi di ogni riga.
const rows = [
{ id: 1, product: 'Laptops', q1: 120, q2: 150, q3: 90, q4: 180 },
{ id: 2, product: 'Phones', q1: 200, q2: 160, q3: 210, q4: 240 },
{ id: 3, product: 'Tablets', q1: 80, q2: 60, q3: 75, q4: 50 },
{ id: 4, product: 'Monitors', q1: 40, q2: 70, q3: 65, q4: 90 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 220,
columns: ['product', ...['q1', 'q2', 'q3', 'q4'].map((f) => ({ field: f, type: 'number', width: 90 })),
{ field: 'trend', header: 'Trend', width: 140, sparkline: { type: 'line', fields: ['q1', 'q2', 'q3', 'q4'], markers: true } },
{ field: 'bars', header: 'Bars', width: 140, sparkline: { type: 'column', fields: ['q1', 'q2', 'q3', 'q4'] } }],
});Grafici di un intervallo di celle
Un grafico a colonne di tre trimestri, disegnato dal grafico SVG integrato nella griglia, in un pannello della griglia.
const rows = [
{ id: 1, product: 'Laptops', q1: 120, q2: 150, q3: 90 },
{ id: 2, product: 'Phones', q1: 200, q2: 160, q3: 210 },
{ id: 3, product: 'Tablets', q1: 80, q2: 60, q3: 75 },
];
const grid = VibeFoxJSGrid.createGrid('#app', { data: rows, rowId: 'id', height: 320, columns: ['product', 'q1', 'q2', 'q3'] });
grid.createRangeChart({ rows: [1, 2, 3], fields: ['product', 'q1', 'q2', 'q3'], type: 'column', title: 'Sales by quarter' });Grandi dati
Scorrimento virtuale
100.000 righe × 50 colonne, con lo scorrimento al centro: nella pagina ci sono solo le celle visibili. Scorrere in entrambe le direzioni.
const columns = [{ field: 'id', type: 'number', pin: 'left', width: 80 }];
for (let c = 1; c <= 50; c++) columns.push({ field: 'c' + c, header: 'Col ' + c, type: 'number', width: 90 });
const rows = Array.from({ length: 100000 }, (_, i) => {
const row = { id: i + 1 };
for (let c = 1; c <= 50; c++) row['c' + c] = (i * c * 7919) % 1000;
return row;
});
const grid = VibeFoxJSGrid.createGrid('#app', { data: rows, columns, rowId: 'id', height: 340, statusBar: true });
grid.scrollToRow(50000);Query in linguaggio naturale
La barra delle query dopo la domanda "from Berlin or Paris, sort by salary descending": i comandi vengono mostrati prima di essere applicati. Applicarli oppure digitare una domanda propria.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 360,
columns: ['name', 'city', 'dept', { field: 'salary', type: 'number' }],
ask: { input: true },
});
grid.ask('from Berlin or Paris, sort by salary descending', { preview: true });Temi e stile
Temi
Scegliere un tema nell'elenco sopra la griglia: light, dark, paper, ocean, sunset o graphite-dark (vibefox-js-themes.css collegato per i temi del pacchetto).
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows, rowId: 'id', height: 300,
columns: ['name', 'dept', 'city', { field: 'salary', type: 'number' }],
selection: { mode: 'row', checkbox: true },
});
grid.setSelection([3]);
const picker = document.createElement('select');
for (const name of ['light', 'dark', 'paper', 'ocean', 'sunset', 'graphite-dark']) picker.add(new Option(name));
picker.onchange = () => grid.setTheme(picker.value);
document.getElementById('app').before(picker);Variabili CSS
Righe più alte, un'intestazione colorata e un colore di selezione personalizzato, impostati come variabili CSS di questa griglia.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 360,
columns: ['name', 'dept', 'city', { field: 'salary', type: 'number' }],
styleVars: {
'row-height': '38px',
'header-bg': '#1e3a8a',
'header-fg': '#ffffff',
'row-selected-bg': '#fde68a',
},
});
grid.setSelection([2, 5]);Stili pronti all'uso
Scegliere uno dei nove stili pronti all'uso nell'elenco sopra la griglia: default, compact, zebra, grid, minimal, cards, finance, report, spreadsheet.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
rows[1].salary = -1200;
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows, rowId: 'id', height: 320, footer: true,
columns: ['name', 'dept', { field: 'salary', type: 'number', aggregate: 'sum' }, { field: 'joined', type: 'date' }],
});
const picker = document.createElement('select');
for (const name of VibeFoxJSGrid.GRID_STYLES) picker.add(new Option(name));
picker.onchange = () => grid.setStyle(picker.value);
document.getElementById('app').before(picker);Densità e dimensione
La densità compatta sul contenitore della pagina: le righe, l'intestazione e i margini interni diventano più piccoli.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
document.getElementById('app').dataset.vfjsDensity = 'compact';
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 260,
columns: ['name', 'dept', 'city', { field: 'salary', type: 'number' }],
});Localizzazione e RTL
Lingue
La griglia in russo: caricare il pacchetto lingua vibefox-js-grid.ru.js dopo la libreria e impostare locale: 'ru'. I menu, il paginatore e la barra di stato vengono tradotti.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 360,
locale: 'ru',
columns: [{ field: 'name', header: 'Имя' }, { field: 'city', header: 'Город' }, { field: 'salary', header: 'Оклад', type: 'number' }],
pagination: { pageSize: 5 },
statusBar: true,
});Da destra a sinistra
L'opzione rtl: true: le colonne iniziano da destra, la colonna fissata è all'inizio della riga.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', {
data: rows,
rowId: 'id',
height: 300,
rtl: true,
columns: [{ field: 'name', pin: 'left' }, 'dept', 'city', { field: 'salary', type: 'number' }],
});Accessibilità
Tastiera
La finestra di aiuto sulla tastiera (Ctrl+/ o F1, oppure showKeyboardHelp()). Chiuderla, fare clic su una cella e spostarsi con i tasti freccia.
const rows = [
{ id: 1, name: 'Alice Brown', dept: 'Sales', city: 'Berlin', salary: 72000, joined: '2021-03-15', active: true, rating: 4 },
{ id: 2, name: 'Bob Smith', dept: 'Sales', city: 'Paris', salary: 58000, joined: '2019-11-02', active: false, rating: 2 },
{ id: 3, name: 'Carol White', dept: 'Engineering', city: 'Berlin', salary: 91000, joined: '2022-06-20', active: true, rating: 5 },
{ id: 4, name: 'Dan Green', dept: 'Engineering', city: 'London', salary: 86000, joined: '2020-01-10', active: true, rating: 3 },
{ id: 5, name: 'Eva Black', dept: 'Support', city: 'Paris', salary: 47000, joined: '2023-02-01', active: true, rating: 4 },
{ id: 6, name: 'Frank Lee', dept: 'Support', city: 'London', salary: 51000, joined: '2018-09-17', active: false, rating: 1 },
{ id: 7, name: 'Grace Kim', dept: 'Engineering', city: 'Madrid', salary: 99000, joined: '2017-05-23', active: true, rating: 5 },
{ id: 8, name: 'Henry Fox', dept: 'Sales', city: 'Madrid', salary: 63000, joined: '2024-04-08', active: true, rating: 3 },
];
const grid = VibeFoxJSGrid.createGrid('#app', { data: rows, rowId: 'id', height: 520 });
grid.showKeyboardHelp();