icflorescu / icflorescu/mantine-datatable

Row expansion and nested table: nested row instead of nested tables

Open
#581 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
When using the nested table feature, if the nested table data has the same type than the parent table, there is an issue with columns width not maching parent columns width, it's also not compatible with column resizing.
Capture d’écran 2024-04-26 à 09 24 28
Of course we can use fixed columns width some issues, but it then adapt poorly to dynamic content.

Describe the solution you'd like
Instead of adding an extra row with colspan and a new table inside, we could have an option to set new rows.
We can't use collapse with table tr, but in this example we can see a way to animate toggling rows : https://stackoverflow.com/a/37376274
We could have an extra property to add new content "as rows":

return (
  <DataTable
    withTableBorder
    withColumnBorders
    columns={[{ accessor: 'name' }, { accessor: 'city' }, { accessor: 'state' }]}
    records={records}
    rowExpansion={{
      rows: [], // 👈 set this to add new "nested" rows
      // ...
    }}
  />
);

This could exists along with the content property to both add rows and nested content (and not breaking curent implementations)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the DataTable rowExpansion implementation and existing content behavior, then compare the proposed rows API with the linked table-row animation example. Done means nested same-type data can render as rows aligned with parent columns and coexist with content without breaking current implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.