material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Tree data does not indent

Open jakeleventhal opened this issue 7 years ago • 16 comments

Describe the bug Tree data does not indent when dropped down

To Reproduce

  1. Create tree data with multiple dropdowns
  2. Expand each row

Expected behavior The title for each dropdown should be indented to show that it is a child of the parent - just like how the arrows indent. The behavior is also correct on grouped tables

Screenshots Screen Shot 2019-06-25 at 7 16 00 PM

jakeleventhal avatar Jun 25 '19 23:06 jakeleventhal

It should be a prop because sometimes the current behavior is desired

jakeleventhal avatar Jun 26 '19 19:06 jakeleventhal

Any update about this issue, please?

victorwvieira avatar Jul 05 '19 09:07 victorwvieira

I'm also looking for a solution!

PS: material-table is awesome 😃

benjaminvdb avatar Aug 01 '19 13:08 benjaminvdb

There's a pull request for this. Any feedback?

dnn5b avatar Sep 06 '19 11:09 dnn5b

Any solution to this yet?

blshort43 avatar Apr 01 '20 19:04 blshort43

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jul 05 '20 18:07 stale[bot]

not stale!

jakeleventhal avatar Jul 05 '20 18:07 jakeleventhal

not stale. I would greatly appreciate if the Pull Request could be merged in as I would love to continue using material-table and do prefer it over lower level table libraries..

Kemperino avatar Aug 12 '20 08:08 Kemperino

This could be accomplished with a simple custom column render function. Just render a div and pass in a left padding according to the depth of the tree the row is at

asharafshahi avatar Sep 18 '20 02:09 asharafshahi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Dec 17 '20 03:12 stale[bot]

no stale

jakeleventhal avatar Dec 17 '20 03:12 jakeleventhal

Has there been any solutions for this?

PhilObi avatar Jan 19 '21 20:01 PhilObi

Here's my solution:

 columns={[
    {
        title: 'FooBar',
        type: 'string',
        field: 'fooBar',
        cellStyle: (rowDataArray, rowData) => {
            const paddingLeft = 30 * rowData.level;
            return ({ paddingLeft: paddingLeft} as React.CSSProperties);
        }
    },

Note that you have to compute the level property (depth) and add it to data.

lpandzic avatar Feb 09 '21 08:02 lpandzic

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar May 13 '21 11:05 stale[bot]

not stale

jakeleventhal avatar May 13 '21 14:05 jakeleventhal

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Aug 11 '21 15:08 stale[bot]