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.

Render props for the header column of Antd Table with TableRowSelection

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Currently, for a table with rowSelection TableRowSelection, we have a props to customize renderCell which allow us to write our own checkboxes, however for the select all checkbox inside the header we do not have such an API to access it.

What does the proposed API look like?

maybe an attribute named renderHeader somehow inside TableRowSelection may fit the demand as above

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
serhatyunacommented, Jul 26, 2022

Any updates on this?

2reactions
gregor-muellercommented, May 10, 2022

I’d also need to make use of this. Our goal is to change the props of the Checkbox (e.g. adding data-* attributes to it. It works perfectly fine for the checkboxes in the rows but for the header, it seems like I’m out of luck.

I’d be fine with either way:

  1. both getHeaderCheckboxProps and renderHeaderCell being added just like getCheckboxProps and renderCell
  2. columnTitle providing the default renderer as a parameter so that we can just inject props (like in renderCell, see below)

I am able to do this:

const rowSelection = {
    // .... other props,
    getCheckboxProps: () => ({
        'data-testid': 'selection-checkbox',
    }),
    renderCell: (_value, _record, _index, originNode) => ({
        props: { 'data-testid': 'table-row-selections-cell' },
        children: originNode,
    }),
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Table - Ant Design
A table displays rows of data. ... Since this is just a syntax sugar for the prop columns , you can't compose Column...
Read more >
Can one control the state of Antd Table's "Check All" control?
If you click the 'Select All' checkbox in the selection column header, Antd will select all the rows on the current page but...
Read more >
Table - Ant Design - GitHub Pages
A Solution for displaying large amounts of data with long columns. Specify the width of columns if header and cell do not align...
Read more >
An Introduction to Ant Tables for JavaScript Developers
The table's components (lines 87-89) are rendered by the renderVitualList function (lines 43-75). Each column is assigned the width prop (lines ...
Read more >
React Table Row Selection Example - TanStack
React Example: Row Selection. CodeSandbox. tanstack-table-example-row-selection. 345. 0. 0. Edit Sandbox. Files. src .gitignore. README.md. index.html.
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