Skip to main content

Documentation: Advanced Datatable with Tree Structures

This document provides a comprehensive guide to implementing hierarchical datatables using the AdminController backend and the TreeDatatable.vue frontend component.

Part 1: Datatable Data Format

The backend generates a standardized JSON object for each row (or “node”) in the datatable. Understanding this structure is key to leveraging all the component’s features.

Anatomy of a Row Object

Property Breakdown

Properties starting with an underscore _ are metadata used to control the UI.

Part 2: Backend - AdminController Setup

To serve tree data, configure these protected properties in your controller that extends AdminController.

Configuration Properties

Example Controller (ChartOfAccountController.php)

This example sets up a lazy-loaded, single-model tree where only “active” accounts can be selected.

Part 3: Frontend - TreeDatatable.vue Usage

The TreeDatatable component is highly configurable via its props.

Key Props

Key Events

Example Parent Component Implementation

This shows how a page would use TreeDatatable to manage all its state.