Data display / Tree table

Data display

Tree table

Nested rows inside a table: a row with children gets a toggle, and opening it shows that level’s rows beneath it, indented one step per level.

import { EcoTreeTable, EcoDataTable } from "vue-ecosphere"

Nested rows

Open York (it loads), Hull (it fails once; Retry) or South region. “Show 2 more” appends to North region, including a level that comes back empty.

Organisation units3 regions
Organisation units. A row with a toggle lists its child units directly below it.
UnitKindParentChildrenVehiclesStatus
North regionRegionNorthwind UK51,240Open
Leeds branchBranchNorth region3258Open
Leeds Central depotDepotLeeds branch096Open
Kirkstall depotDepotLeeds branch074Open
Morley depotDepotLeeds branch088Closed
York branchBranchNorth region4268Open
Hull branchBranchNorth region2141Open

Showing 3 of 5 branches in North region

South regionRegionNorthwind UK601,512Open
East regionRegionNorthwind UK00Closed

1–3 of 3 regions

A repeated unit

A row whose id is already among its ancestors never gets a toggle, so a cycle cannot loop requests.

West region units
West region units. A row with a toggle lists its child units directly below it.
UnitKindParentChildrenVehiclesStatus
West regionRegionNorthwind UK4980Open
Northwind UKOrganisationWest region33,732Open
West regionRepeats higher up, so it is not expanded again.RegionNorthwind UK4980Open

API

NameTypeDefaultDescription
columnsEcoTableColumn[]—The first column is the name cell (th scope=row) with the toggle or spacer.
rowsEcoTreeTableRow[]—{ id, cells, href?, sub?, children?, hasChildren?, state?, stateText?, more? }. Rows stay flat tr in one tbody.
v-model:expandedstring[][]Open rows. Keep them in the URL with the rest of the table’s query.
captionstring—Say that a row with a toggle lists its child units directly below it.
compact / sticky / nowrapbooleanfalse / false / trueTable modifiers.
repeatTextstring—Second line on a row that repeats among its ancestors (no toggle, loop icon).
#cell-<key>{ row, value, depth }—Override a cell.
#more{ row }—Replace the “Show more” button, e.g. with a pager--compact.
@toggle / @retry / @more(row[, open]) => void—Load a level when it opens, reload a failed level, append the next page.