Vue UI Components Documentation
The Vue Grid enables users to display tabular data. This guide adds the Vue Grid (jqxGrid) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxgrid.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxgrid.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Binding to JS Array demo as a Single-File Component:
<template>
<JqxGrid
:width="width"
:source="dataAdapter"
:columns="columns"
:columnsresize="true"
:sortable="true"
>
</JqxGrid>
</template>
<script setup>
import { ref } from 'vue';
import JqxGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxgrid.vue';
let source = {
localdata: [
[
'Alfreds Futterkiste',
'Maria Anders',
'Sales Representative',
'Obere Str. 57',
'Berlin',
'Germany'
],
[
'Ana Trujillo Emparedados y helados',
'Ana Trujillo',
'Owner',
'Avda. de la Constitucin 2222',
'México D.F.',
'Mexico'
],
[
'Antonio Moreno Taquería',
'Antonio Moreno',
'Owner',
'Mataderos 2312',
'México D.F.',
'Mexico'
],
[
'Around the Horn',
'Thomas Hardy',
'Sales Representative',
'120 Hanover Sq.',
'London',
'UK'
],
[
'Berglunds snabbköp',
'Christina Berglund',
'Order Administrator',
'Berguvsvgen 8',
'Luleå',
'Sweden'
],
[
'Blauer See Delikatessen',
'Hanna Moos',
'Sales Representative',
'Forsterstr. 57',
'Mannheim',
'Germany'
],
[
'Blondesddsl père et fils',
'Frédérique Citeaux',
'Marketing Manager',
'24, place Klber',
'Strasbourg',
'France'
],
[
'Bólido Comidas preparadas',
'Martín Sommer',
'Owner',
'C\/ Araquil, 67',
'Madrid',
'Spain'
],
['Bon app', 'Laurence Lebihan', 'Owner', '12, rue des Bouchers', 'Marseille', 'France'],
[
'Bottom-Dollar Markets',
'Elizabeth Lincoln',
'Accounting Manager',
'23 Tsawassen Blvd.',
'Tsawassen',
'Canada'
],
[
'B`s Beverages',
'Victoria Ashworth',
'Sales Representative',
'Fauntleroy Circus',
'London',
'UK'
],
[
'Cactus Comidas para llelet',
'Patricio Simpson',
'Sales Agent',
'Cerrito 333',
'Buenos Aires',
'Argentina'
],
[
'Centro comercial Moctezuma',
'Francisco Chang',
'Marketing Manager',
'Sierras de Granada 9993',
'México D.F.',
'Mexico'
],
['Chop-suey Chinese', 'Yang Wang', 'Owner', 'Hauptstr. 29', 'Bern', 'Switzerland'],
[
'Comércio Mineiro',
'Pedro Afonso',
'Sales Associate',
'Av. dos Lusadas, 23',
'Sao Paulo',
'Brazil'
],
[
'Consolidated Holdings',
'Elizabeth Brown',
'Sales Representative',
'Berkeley Gardens 12 Brewery',
'London',
'UK'
],
[
'Drachenblut Delikatessen',
'Sven Ottlieb',
'Order Administrator',
'Walserweg 21',
'Aachen',
'Germany'
],
[
'Du monde entier',
'Janine Labrune',
'Owner',
'67, rue des Cinquante Otages',
'Nantes',
'France'
],
['Eastern Connection', 'Ann Devon', 'Sales Agent', '35 King George', 'London', 'UK'],
['Ernst Handel', 'Roland Mendel', 'Sales Manager', 'Kirchgasse 6', 'Graz', 'Austria']
],
datafields: [
{ name: 'CompanyName', type: 'string', map: '0' },
{ name: 'ContactName', type: 'string', map: '1' },
{ name: 'Title', type: 'string', map: '2' },
{ name: 'Address', type: 'string', map: '3' },
{ name: 'City', type: 'string', map: '4' },
{ name: 'Country', type: 'string', map: '5' }
],
datatype: 'array'
};
const width = ref('90%');
const dataAdapter = ref(new jqx.dataAdapter(source));
const columns = ref([
{ text: 'Company Name', datafield: 'CompanyName', width: 200 },
{ text: 'Contact Name', datafield: 'ContactName', width: 150 },
{ text: 'Contact Title', datafield: 'Title', width: 100 },
{ text: 'Address', datafield: 'Address', width: 100 },
{ text: 'City', datafield: 'City', width: 100 },
{ text: 'Country', datafield: 'Country' }
]);
</script>
<style></style>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, rowselect: This event is triggered when a row is selected.
<script setup>
function onRowselect(event) {
console.log(event.args);
}
</script>
<template>
<JqxGrid @rowselect="onRowselect" />
</template>
Call methods through a template ref. For example, getselectedrowindex: Gets the bound index of the selected row.
<script setup>
import { ref, onMounted } from 'vue';
const myGrid = ref(null);
onMounted(() => {
const index = myGrid.value.getselectedrowindex();
console.log(index);
});
</script>
<template>
<JqxGrid ref="myGrid" />
</template>
Every component also has setOptions({ … }) and getOptions('name').