njleonzhang / vue-data-tables

A simple, customizable and pageable table with SSR support, based on vue2 and element-ui
https://njleonzhang.github.io/vue-data-tables
MIT License
1.02k stars 221 forks source link

Lazy loading tree data #254

Closed stefanknegt closed 4 years ago

stefanknegt commented 4 years ago

Online reproduce

https://codepen.io/steeviek/pen/yLNJWVP

Expected Behavior

The rows are expandable and the load method is called to show the tree data.

Current Behavior

Unable to expand the rows when 'children' arrays are empty in the beginning. However, I want to be able to lazy load the children rows, just like in Element-UI (see https://element.eleme.io/#/en-US/component/table).

Steps to Reproduce

Open the codepen and you will see it is not possible to expand the last row, while it has the children property set.

Detailed Description

In Element-UI you can set lazy to true and then lazy load the data of the expanding rows when a row is expanded. However, I am unable to expand a row with this package when there are no children set on initial load.

stefanknegt commented 4 years ago

It was my mistake, sorry. For future reference: you need to set lazy to true in the tableProps and not on the table itself and set the right row-key in the tableProps.