Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

app_sizing width examples in Dash Table#121

Closed
valentijnnieman wants to merge 4 commits into
developfrom
114-widths-examples
Closed

app_sizing width examples in Dash Table#121
valentijnnieman wants to merge 4 commits into
developfrom
114-widths-examples

Conversation

@valentijnnieman

Copy link
Copy Markdown
Contributor

Hey, here's a first stab at examples of setting widths in Dash Table. Not all of them work, I'm not sure if it's because something isn't working or if it's because I didn't do it the right way / didn't use the right prop, so let me know! I took the liberty of adding the examples from #116 so I could move quickly on that, sorry if that's causing issues somehow. The last example, Dash Table - Alignment isn't there because I wasn't sure what that should be.

Closes #114

@chriddyp
chriddyp temporarily deployed to dash-table-review-pr-121 October 2, 2018 15:10 Inactive
@chriddyp

chriddyp commented Oct 2, 2018

Copy link
Copy Markdown
Member

adding @Marc-Andre-Rivet as well for review

Comment thread tests/dash/app_sizing.py
'selector': '.dash-spreadsheet',
'rule': 'height: 300px; overflow: scroll;'
}]
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing a double scroll bar here:
image

Comment thread tests/dash/app_sizing.py
'selector': '.dash-cell',
'rule': 'padding-left: 10px;'
}]
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the default HTML style, the cells expand to their content:
image

In the dash-table, we have fixed width columns. Could we add an example where the cell's width expands to the content? We might want to make that the default. Here's how it looks now:
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be problematic with fixed rows.. as it stands right now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be problematic with fixed rows.. as it stands right now

As I've mentioned before, I want us consider the case where we don't have fixed rows right now. I'm OK with fixed rows vs not fixed rows having different limitations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#130 will provide support for default cell width

Comment thread tests/dash/app_sizing.py
section_title("Dash Table - Widths that are smaller than the content"),
# ...
section_title("Dash Table - Content with Ellipses"),
section_title("Dash Table - Content with Ellipses [Not Working]"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marc-Andre-Rivet can you review all of these "[Not Working]" examples?

Comment thread tests/dash/app_sizing.py
'selector': '.dash-spreadsheet',
'rule': 'max-height: 300px; overflow: scroll;'
}]
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this example was to show that the table container wouldn't expand past its max height. In the HTML example, it was demonstrated by using 3 rows of data but setting the max height to something much larger:
image

So, could we update this example to use df (3 rows) instead of df_long?

Comment thread tests/dash/app_sizing.py Outdated
# ...
dash_table.Table(
id="dt-vert-scroll",
dataframe=df_long.to_dict("rows"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here (use df instead of df_long to demonstrate how setting a height works with short content)
image

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

@chriddyp @valentijnnieman PR #129 should take care of the width % scenarios in master

To activate correct % behavior you will need to add
content_style='grow' // usually the table wrapper takes only as much space as the table requires to display itself, with 'grow' we invert this behavior and make the table and wrapper grow to fill all the available space instead (default='fit')

You still need to set a width for .dash-spreadsheet as before.
If you want/need the fixed rows to have % width, an additional selector '.dash-fixed-column' with some width will be required. Do note that the fixed columns are in their own table so the % width there are independent from the % width in the content section -- 50% on one side may be bigger/smaller than on the other size of the "fixed line"

@Marc-Andre-Rivet

Marc-Andre-Rivet commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

@chriddyp @valentijnnieman With paging/filtering/sorting there is no perfect way to "fit to content" for columns. One middle ground approach would be to use the initial df/viewport to analyze to figure out what the columns width should be and then fix the columns width for the table -- some mechanism to unlock/refresh could be put in place -- but it's not easy to have a fully "fit to content" table as the inputs don't play nice and force the column width to change if there's nothing forcing the width.

Some basic version of this could be put in place in develop once the refactor PR goes through.

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

Upate on all this, #130 will provide support for "fit content" / default width for all scenarios (no fixed, rows, columns, both) -- behavior as of 130 will be to match current table content, that means the cell widths will automatically update as the content changes. We can always revisit later for more refined behaviors.

This review has not been forgotten.

@chriddyp

Copy link
Copy Markdown
Member

Should we close this in preference for #130 ?

@Marc-Andre-Rivet

Copy link
Copy Markdown
Contributor

I think so. I can fill in for the missing examples after dev gets merged into master (#133)

@Marc-Andre-Rivet
Marc-Andre-Rivet deleted the 114-widths-examples branch July 18, 2019 12:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants