Vue UI Components Documentation
The Vue TreeGrid represents data in a tree-like structure. This guide adds the Vue TreeGrid (jqxTreeGrid) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxtreegrid.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxTreeGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxtreegrid.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 JSON Data demo as a Single-File Component:
<template>
<JqxTreeGrid
ref="myTreeGrid"
:width="width"
:sortable="true"
:ready="ready"
:columns="columns"
:columnGroups="columnGroups"
:source="dataAdapter"
>
</JqxTreeGrid>
</template>
<script setup>
import { ref } from 'vue';
import JqxTreeGrid from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxtreegrid.vue';
const myTreeGrid = ref(null);
let employees = [
{
EmployeeID: 1,
FirstName: 'Nancy',
LastName: 'Davolio',
ReportsTo: 2,
Country: 'USA',
Title: 'Sales Representative',
HireDate: '2024-04-26 00:00:00',
BirthDate: '1980-12-03 00:00:00',
City: 'Seattle',
Address: '507 - 20th Ave. E.Apt. 2A'
},
{
EmployeeID: 2,
FirstName: 'Andrew',
LastName: 'Fuller',
ReportsTo: null,
Country: 'USA',
Title: 'Vice President, Sales',
HireDate: '2024-08-09 00:00:00',
BirthDate: '1984-02-14 00:00:00',
City: 'Tacoma',
Address: '908 W. Capital Way'
},
{
EmployeeID: 3,
FirstName: 'Janet',
LastName: 'Leverling',
ReportsTo: 2,
Country: 'USA',
Title: 'Sales Representative',
HireDate: '2024-03-27 00:00:00',
BirthDate: '1995-08-25 00:00:00',
City: 'Kirkland',
Address: '722 Moss Bay Blvd.'
},
{
EmployeeID: 4,
FirstName: 'Margaret',
LastName: 'Peacock',
ReportsTo: 2,
Country: 'USA',
Title: 'Sales Representative',
HireDate: '2025-04-28 00:00:00',
BirthDate: '1969-09-14 00:00:00',
City: 'Redmond',
Address: '4110 Old Redmond Rd.'
},
{
EmployeeID: 5,
FirstName: 'Steven',
LastName: 'Buchanan',
ReportsTo: 2,
Country: 'UK',
Title: 'Sales Manager',
HireDate: '2025-10-12 00:00:00',
BirthDate: '1987-02-27 00:00:00',
City: 'London',
Address: '14 Garrett Hill'
},
{
EmployeeID: 6,
FirstName: 'Michael',
LastName: 'Suyama',
ReportsTo: 5,
Country: 'UK',
Title: 'Sales Representative',
HireDate: '2025-10-12 00:00:00',
BirthDate: '1995-06-27 00:00:00',
City: 'London',
Address: 'Coventry House Miner Rd.'
},
{
EmployeeID: 7,
FirstName: 'Robert',
LastName: 'King',
ReportsTo: 5,
Country: 'UK',
Title: 'Sales Representative',
HireDate: '2025-12-28 00:00:00',
BirthDate: '1992-05-24 00:00:00',
City: 'London',
Address: 'Edgeham Hollow Winchester Way'
},
{
EmployeeID: 8,
FirstName: 'Laura',
LastName: 'Callahan',
ReportsTo: 2,
Country: 'USA',
Title: 'Inside Sales Coordinator',
HireDate: '2026-02-28 00:00:00',
BirthDate: '1990-01-04 00:00:00',
City: 'Seattle',
Address: '4726 - 11th Ave. N.E.'
},
{
EmployeeID: 9,
FirstName: 'Anne',
LastName: 'Dodsworth',
ReportsTo: 5,
Country: 'UK',
Title: 'Sales Representative',
HireDate: '2026-11-10 00:00:00',
BirthDate: '1998-01-22 00:00:00',
City: 'London',
Address: '7 Houndstooth Rd.'
}
];
// prepare the data
let source = {
dataType: 'json',
dataFields: [
{ name: 'EmployeeID', type: 'number' },
{ name: 'ReportsTo', type: 'number' },
{ name: 'FirstName', type: 'string' },
{ name: 'LastName', type: 'string' },
{ name: 'Country', type: 'string' },
{ name: 'City', type: 'string' },
{ name: 'Address', type: 'string' },
{ name: 'Title', type: 'string' },
{ name: 'HireDate', type: 'date' },
{ name: 'BirthDate', type: 'date' }
],
hierarchy: { keyDataField: { name: 'EmployeeID' }, parentDataField: { name: 'ReportsTo' } },
id: 'EmployeeID',
localData: employees
};
const width = ref('90%');
const dataAdapter = ref(new jqx.dataAdapter(source));
const columns = ref([
{ text: 'FirstName', columnGroup: 'Name', dataField: 'FirstName', width: 200 },
{ text: 'LastName', columnGroup: 'Name', dataField: 'LastName', width: 200 },
{ text: 'Title', dataField: 'Title', width: 160 },
{ text: 'Birth Date', dataField: 'BirthDate', cellsFormat: 'd', width: 120 },
{ text: 'Hire Date', dataField: 'HireDate', cellsFormat: 'd', width: 120 },
{ text: 'Address', dataField: 'Address', width: 250 },
{ text: 'City', dataField: 'City', width: 120 },
{ text: 'Country', dataField: 'Country' }
]);
const columnGroups = ref([{ text: 'Name', name: 'Name' }]);
function ready() {
myTreeGrid.value.expandRow(2);
}
</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, bindingComplete: This event is triggered when the jqxTreeGrid binding is completed.
<script setup>
function onBindingComplete(event) {
console.log(event.args);
}
</script>
<template>
<JqxTreeGrid @bindingComplete="onBindingComplete" />
</template>
Call methods through a template ref. For example, refresh: Performs a layout and updates the HTML elements position and size.
<script setup>
import { ref, onMounted } from 'vue';
const myTreeGrid = ref(null);
onMounted(() => {
myTreeGrid.value.refresh();
});
</script>
<template>
<JqxTreeGrid ref="myTreeGrid" />
</template>
Every component also has setOptions({ … }) and getOptions('name').