question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expand all header

See original GitHub issue

What problem does this feature solve?

It feels natural to have an expand all button alongside with onExpandAll property, the same way it’s done for selection column. It can be achieved using existing api, but UI would be much cleaner with header button.

And perhaps it makes sense to group expandable options too. (see proposal api).

p.s. Thanks for the amazing product!

What does the proposed API look like?

<Table
        ...
        rowExpansion={{
          expandedRowKeys: <...>,
          expandedRowRender: <...>,
         ...


          onExpandAll: <..>,
        }}
/>

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:19 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
MihaiWillcommented, Feb 22, 2021

@afc163 any update on the expandAll prop? <Table expandAll={true | false} />

3reactions
rhysdiabcommented, Aug 28, 2020

I put together a temporary solution using expandedRowKeys. When expandAllRows is set to true, the expandedRowKeys property is set, and contains every row key.

import React, { useState } from 'react';
import { Table } from 'antd';

function Table({ columns, dataSource }) {
 [expandAllRows, setExpandAllRows] = useState(true);

 const getExpandedRowKeys = dataSource => {
  const keyArray = dataSource.map(object => {
   if (object.children && object.children.length !== 0) {
    return [object.key, getExpandedRowKeys(object.children)];
   }

   return object.key;
  });
  return keyArray.flat(10);
 };

 const expandedRowKeys = getExpandedRowKeys(dataSource);

 const expandable = {
  ...(expandAllRows && { expandedRowKeys }),
 };

 return <Table columns={columns} dataSource={dataSource} expandable={expandable} />;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to collapse all headers in Word 2013? - Super User
Right click on a header, select Expand/Collapse > Expand All Headings (or Collapse All Headings ). Also you may like to have shortcuts...
Read more >
How to Create Collapsible Headings in Word - TurboFuture
Expand or Collapse All. You can expand or collapse all headings in the document by right-clicking any heading and selecting Expand All Headings...
Read more >
Q. How to Expand and Collapse Parts of a Word Document
There is a quick way to expand or collapse all headings in your document; right click on a heading > Expand/Collapse, and select...
Read more >
Expand and Collapse all headers - Dropbox Community
Hi, is there a way I haven't found to collapse all headers in a document? For long documents it would be really nice...
Read more >
How to Collapse and Expand Parts of Your Document in Word
To do this, right-click on any heading and move your mouse over “Expand/Collapse” on the popup menu. Then, select “Collapse All Headings” from ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found