tusen-ai / naive-ui

A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.
https://www.naiveui.com
MIT License
16.23k stars 1.67k forks source link

Data table default-expand-all attribute asynchronously #4915

Closed haohao809 closed 8 months ago

haohao809 commented 1 year ago

This function solves the problem (这个功能解决的问题)

Whether to expand all expandable rows by default in the default-expand-all attribute, which cannot be used when expanding rows asynchronously. The data of the table is all asynchronous. Can lazy loading and asynchronous expansion be done? Currently, my solution is to get all the data through a callback before displaying the fully expanded table.

Expected API (期望的 API)

be used when expanding rows asynchronously

2556227850 commented 1 year ago

我也想知道这个问题怎么解决

Amine27 commented 1 year ago

This function solves the problem (这个功能解决的问题)

Whether to expand all expandable rows by default in the default-expand-all attribute, which cannot be used when expanding rows asynchronously. The data of the table is all asynchronous. Can lazy loading and asynchronous expansion be done? Currently, my solution is to get all the data through a callback before displaying the fully expanded table.

Expected API (期望的 API)

be used when expanding rows asynchronously

Can you share your solution please? Thank you.

Kerwin1202 commented 1 year ago

+1 曲线救国

setInterval(function () {
  const expandTriggers = document.querySelectorAll('.n-data-table-expand-trigger');
  expandTriggers.forEach(trigger => {
    const grandparent = trigger.parentNode.parentNode;
    if (grandparent.className.indexOf('expanded') <= -1) {
      trigger.click();
    }
  });
}, 300)
jahnli commented 8 months ago

This issue does not have any recent activity. If you are still experiencing similar problems, open a new error, including a minimal copy of the problem