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

Hiding scrollbar of fixed columns/rows with enableFixedColumnScroll/enableFixedRowScroll #804

Closed
Liooo opened this issue Sep 6, 2017 · 8 comments

Comments

@Liooo
Copy link

Liooo commented Sep 6, 2017

Currently enabling scroll on fixed columns shows scrollbars for both fixed/non-fixed columns. It'd be nice to be able to show scrollbar only on non-fixed columns. (same as rows)

@bvaughn
Copy link
Owner

bvaughn commented Sep 6, 2017

To my knowledge, this isn't possible. Scrollbars are browser-managed. Without a custom scrolling solution (which RV doesn't really support, since it's hacky and generally bad for performance) there's not much I can do.

Please feel free to open a PR with any proposals you have if you're aware of something I'm not. 😄

@bvaughn bvaughn closed this as completed Sep 6, 2017
@Liooo
Copy link
Author

Liooo commented Sep 6, 2017

@bvaughn thanks for the quick response.

I did it before in my project and just dug up the commit now, this is basically what's hacky bad performance you referred to , correct? (though it only work on webkit)

scroll

diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss
index 1c2a9fe..3e868f7 100644
--- a/app/assets/stylesheets/main.scss
+++ b/app/assets/stylesheets/main.scss
@@ -211,3 +211,9 @@ html, body, example {
   //max-height: 800px!important;
 }
 
+.ReactVirtualized__MultiGrid__BottomLeft::-webkit-scrollbar{
+  display: none;
+}
+.ReactVirtualized__MultiGrid__TopRight::-webkit-scrollbar{
+  display: none;
+}
diff --git a/client/app/bundles/common/components/MultiGrid.js b/client/app/bundles/common/components/MultiGrid.js
index 5dec055..fb201c1 100644
--- a/client/app/bundles/common/components/MultiGrid.js
+++ b/client/app/bundles/common/components/MultiGrid.js
@@ -491,7 +491,7 @@ export default class MultiGrid extends PureComponent {
       this._bottomLeftGridStyle = {
         left: 0,
         overflowX: 'hidden',
-        overflowY: 'hidden',
+        overflowY: 'scroll',
         position: 'absolute',
         ...styleBottomLeftGrid
       }
@@ -530,7 +530,7 @@ export default class MultiGrid extends PureComponent {
     ) {
       this._topRightGridStyle = {
         left: this._getLeftGridWidth(props),
-        overflowX: 'hidden',
+        overflowX: 'scroll',
         overflowY: 'hidden',
         position: 'absolute',
         top: 0,
@@ -568,11 +568,13 @@ export default class MultiGrid extends PureComponent {
       _renderBottomLeftGrid (props) {
         .....

         {...props}
         cellRenderer={this._cellRendererBottomLeftGrid}
         columnCount={fixedColumnCount}
+        className="ReactVirtualized__MultiGrid__BottomLeft"
         height={this._getBottomGridHeight(props)}
         ref={this._bottomLeftGridRef}
         rowCount={Math.max(0, rowCount - fixedRowCount) + 1/* See _rowHeightBottomGrid */}
         rowHeight={this._rowHeightBottomGrid}
         scrollTop={scrollTop}
+        onScroll={({scrollTop})=>this._onScroll({scrollTop})}
         style={this._bottomLeftGridStyle}
         tabIndex={null}
         width={this._getLeftGridWidth(props)}

@@ -651,10 +654,12 @@ export default class MultiGrid extends PureComponent {

       _renderTopRightGrid (props) {
         .....

         cellRenderer={this._cellRendererTopRightGrid}
         columnCount={Math.max(0, columnCount - fixedColumnCount) + 1/* See _columnWidthRightGrid */}
         columnWidth={this._columnWidthRightGrid}
+        className="ReactVirtualized__MultiGrid__TopRight"
         height={this._getTopGridHeight(props)}
         ref={this._topRightGridRef}
         rowCount={fixedRowCount}
         scrollLeft={scrollLeft}
+        onScroll={({scrollLeft})=>this._onScroll({scrollLeft})}
         style={this._topRightGridStyle}
         tabIndex={null}
         width={this._getRightGridWidth(props)}

@RaviDasari
Copy link
Contributor

RaviDasari commented Jan 24, 2018

@bvaughn , I fixed with simple css and an extra container. This stackoverflow is the inspiration for my solution. here is how it looks.

multigrid-scrolling

I tested this in latest chrome, firefox, edge and IE11 and it works. in short, I am simply hiding the scrollbar by adding an extra container. So I am sure this works in all browsers.

Are you cool with this fix ? I can raise a PR if you are okay.

@rhinoceraptor
Copy link

@RaviDasari is the change a PR to react virtualized, or can it be done without modifying react virtualized?

@RaviDasari
Copy link
Contributor

@rhinoceraptor , We need to wrap the bottom left grid with a div and add some styles according to my post - (check stackoverflow link) above. So the changes need to be done to MultiGrid component.

I will raise a PR soon - in couple days.

@mattpage
Copy link

mattpage commented Mar 1, 2018

@RaviDasari +1

@mattpage
Copy link

mattpage commented Mar 7, 2018

@RaviDasari any word on this? Having a fixed row header without the scrollbar would be amazing!

RaviDasari added a commit to RaviDasari/react-virtualized that referenced this issue Mar 7, 2018
@RaviDasari
Copy link
Contributor

Just raised a PR. I think I still need to add new tests and fix tests. Will do soon.

wuweiweiwu pushed a commit that referenced this issue May 15, 2018
…rs but still make the scroll events work on those grids (#1040)

* #804 adding options to hide MultiGrid top-right and bottom-left grid scrollbars

* adding unit tests for hideTopRightGridScrollbar & hideBottomLeftGridScrollbar flags

* Updating docs with these new flags

* fixing eslint, now all the source 100% lint errors free
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants