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
| Unit | Kind | Parent | Children | Vehicles | Status |
|---|---|---|---|---|---|
| North region | Region | Northwind UK | 5 | 1,240 | Open |
| Leeds branch | Branch | North region | 3 | 258 | Open |
| Leeds Central depot | Depot | Leeds branch | 0 | 96 | Open |
| Kirkstall depot | Depot | Leeds branch | 0 | 74 | Open |
| Morley depot | Depot | Leeds branch | 0 | 88 | Closed |
| York branch | Branch | North region | 4 | 268 | Open |
| Hull branch | Branch | North region | 2 | 141 | Open |
Showing 3 of 5 branches in North region | |||||
| South region | Region | Northwind UK | 60 | 1,512 | Open |
| East region | Region | Northwind UK | 0 | 0 | Closed |
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
| Unit | Kind | Parent | Children | Vehicles | Status |
|---|---|---|---|---|---|
| West region | Region | Northwind UK | 4 | 980 | Open |
| Northwind UK | Organisation | West region | 3 | 3,732 | Open |
| West regionRepeats higher up, so it is not expanded again. | Region | Northwind UK | 4 | 980 | Open |
API
| Name | Type | Default | Description |
|---|---|---|---|
columns | EcoTableColumn[] | — | The first column is the name cell (th scope=row) with the toggle or spacer. |
rows | EcoTreeTableRow[] | — | { id, cells, href?, sub?, children?, hasChildren?, state?, stateText?, more? }. Rows stay flat tr in one tbody. |
v-model:expanded | string[] | [] | Open rows. Keep them in the URL with the rest of the table’s query. |
caption | string | — | Say that a row with a toggle lists its child units directly below it. |
compact / sticky / nowrap | boolean | false / false / true | Table modifiers. |
repeatText | string | — | 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. |