Vue3-datatables
  • Dependencies & Compatability
  • Getting Started
  • Client Table
    • Asynchronous Loading
    • Grouping
    • Filtering Algorithm
    • Editable Cells
  • Server Table
    • Implementations
    • Custom Request Function
    • Setting Multiple Request Parameters
    • Error Message
    • Draw Counter
  • Dependencies & Compatability
  • Getting Started
  • Virtual Pagination
  • Column Templates
  • Nested Data Structures
  • Selectable Rows
  • List Filters
  • Custom Template
  • Custom Filters
  • Multiple Sorting
  • Date Columns
  • Custom Sorting
  • Conditional Cell Styling
  • Columns Visibility
  • Child Rows
  • Properties
  • Slots
  • Methods
  • Events
Powered by GitBook
On this page

Child Rows

PreviousColumns VisibilityNextProperties

Child rows allow for a custom designed output area, namely a hidden child row underneath each row, whose content you are free to set yourself.

When using the `childRow` option you must pass a unqiue `id` property for each row, which is used to track the current state.

If your identifier key is not `id`, use the `uniqueKey` option to set it.

The syntax is identical to that of templates:

<template v-slot:child_row="props">

<div><b>First name:</b> {{props.row.first_name}}</div>

<div><b>Last name:</b> {{props.row.last_name}}</div>

Using a function and (optional) JSX:

childRow: function(h, row) {

return <div>My custom content for row {row.id}</div>

Using a component name or a `.vue` file: (See

for a complete example)

childRow: 'row-component'

When the plugin detects a `childRow` function it appends the child rows and prepends to each row an additional toggler column with a `span` you can design to your liking.

Example styling (also found in `style.css`):

.VueTables__child-row-toggler {

.VueTables__child-row-toggler--closed::before {

.VueTables__child-row-toggler--open::before {

You can also trigger the child row toggler programmtically. E.g, to toggle the row with an id of 4:

this.$refs.myTable.toggleChildRow(4); // replace myTable with your own ref

Alternatively, you can use the `showChildRowToggler` option to prevent the child row toggler cells from being rendered. (See

)

Disabling Specific Child Rows

Sometimes there are some child rows that have no content. You can disable the togglers for these rows by providing the logic to the disabledChildRows option, e.g:

disabledChildRows: function(row) {

Templates
Options API