Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide isScrollbarVisible for table #1539

Merged
merged 1 commit into from
Sep 29, 2015
Merged

Provide isScrollbarVisible for table #1539

merged 1 commit into from
Sep 29, 2015

Conversation

CumpsD
Copy link
Contributor

@CumpsD CumpsD commented Aug 29, 2015

Right now, when the Table has enough elements in the body, it will gain a scrollbar.

Since this scrollbar is applied to the main rows, the header actually has no clue about it. In some cases, this might break positioning of header elements (because the main rows suddenly get a little bit smaller width due to a visible scrollbar).

By providing a isScrollbarVisible() on Table the caller can determine if a scrollbar is visible, and take it into account in his styles to possibly offset this.

@oliviertassinari
Copy link
Member

I feel like this PR is not compatible with react@0.14. See #1030

@CumpsD
Copy link
Contributor Author

CumpsD commented Aug 30, 2015

How should a component give feedback to the outside in react 0.14? Just dump it in the props so a parent can read it out?

@oliviertassinari
Copy link
Member

Turn out we can according to this passage of the post Refs to custom component classes work exactly as before.

@CumpsD
Copy link
Contributor Author

CumpsD commented Aug 30, 2015

Ah, good :)

shaurya947 added a commit that referenced this pull request Sep 29, 2015
Provide isScrollbarVisible for table
@shaurya947 shaurya947 merged commit 2a0f948 into mui:master Sep 29, 2015
@@ -148,6 +148,13 @@ let Table = React.createClass({
);
},

isScrollbarVisible() {
const tableDivHeight = React.findDOMNode(this.refs.tableDiv).clientHeight;
const tableBodyHeight = React.findDOMNode(this.refs.tableBody).clientHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

The findDOMNode call would need to be changed whenever we move to react 0.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants