ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Allow hiding scrollbars if they are not necessary

Open MariMax opened this issue 11 years ago • 22 comments

I can't hide horizontal scrollbar, even if my table is narrow exapmle I can fully hide it by set enableHorizontalScrollbar = 0, but I need this scroll bar when I dynamically add columns

MariMax avatar Jan 26 '15 10:01 MariMax

I'm having the same issue (with the latest unstable).

I wanted to try without the vertical scrollbar, but for some reason "enableVerticalScrollbar: false" on the gridOptions is being ignored (for me anyway).

If i set overflow-x: auto and overflow-y:hidden on the ui-grid-viewport div, the horizontal scrollbar works as expected: disappears if the colums can fit in the viewport and scrolling correctly if they cannot. It also fixes this weird scroll issue when you scroll all the way to the right:

image

I'm no expert on dom's, so I'm not sure how to work the viewport to include the vertical scrollbar correctly.

herdanskecommodities avatar Jan 29 '15 20:01 herdanskecommodities

I face the same issue, any ideas how to fix it ?

kolesnik avatar Feb 07 '15 21:02 kolesnik

Same here :( any solution?

bluesky777 avatar Feb 22 '15 10:02 bluesky777

@herdanskecommodities Your issue should no longer occur.

WHEN_NEEDED is no longer a valid option for the enable scrollbar properties. You can still toggle whether they're on or off, though. See this plunker for an example: http://plnkr.co/edit/h7uJHM2tZ0bSqkWInjOU?p=preview

c0bra avatar Feb 22 '15 17:02 c0bra

Hi @c0bra , and thanks for the update + poke.

It would be neat to be able to have WHEN_NEEDED as an option, but I am assuming it would be difficult to re-implement in the current version?

It's not a must-have for the system I am working on right now, I am just curious why the option was removed, and whether there is any plans for it to make a return. =)

herdanskecommodities avatar Feb 23 '15 07:02 herdanskecommodities

@swalters may be able to comment on that; I wasn't involved in the removal but my bet is that it's difficult to re-implement with the current native scrolling, yes.

c0bra avatar Feb 23 '15 15:02 c0bra

I think this can be solved by removing the width of the vertical scrollbar from the ui-grid-canvas width...If i have a grid which fits perfectly Original: image

See when i remove 30px from it (width of vertical scrollbar) the horizontal bar disapears: image

Could this be implemented @c0bra ? I have the problem that @herdanskecommodities has (yous aid it was solved but I seem to have the issue?)

Ah, I think it's solved in 3.0.0-rc.20!

PhilBroadbent avatar Mar 03 '15 12:03 PhilBroadbent

I am using 3.0.0-rc.20 but. I still see the scrollbar issue.

pragatir avatar Mar 04 '15 06:03 pragatir

I do not really know should it be here or should I create a new issue, this is about column adjustment ui-grid-bug-ie rc.20, IE-9

MilovanovMaxim avatar Mar 10 '15 13:03 MilovanovMaxim

@pragatir Are you able to reproduce it in a plunker?

c0bra avatar Mar 11 '15 21:03 c0bra

@PhilBroadbent it may be possible to implement it that way, yes.

c0bra avatar Mar 11 '15 21:03 c0bra

@c0bra : As like @pragatir , me too using 3.0.0-rc.20 and facing the same issue. Here the apis are completely changed, for horizontal scroll bar, the values are different when compared to old version. The possible values are (from api guide) enableHorizontalScrollbar : uiGridConstants.scrollbars.ALWAYS by default. This settings controls the horizontal scrollbar for the grid. Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER (not like ur pluker, $scope.gridOptions.enableHorizontalScrollbar = 2;)

so no possiblity to show whenever its needed..

do u have any idea to fix this issue?

svmashok avatar Mar 12 '15 12:03 svmashok

@svmashok Adding a "WHEN_NEEDED" option should be possible, but we'll push it to v3.1 so it's not blocking a 3.0 release.

c0bra avatar Mar 30 '15 15:03 c0bra

@MilovanovMaxim Can you get the scroll issue to happen in IE9 in this plunker? http://plnkr.co/edit/h7uJHM2tZ0bSqkWInjOU?p=preview

c0bra avatar Mar 30 '15 15:03 c0bra

I am using v3.0.4 but I still got the same issue as @herdanskecommodities

image

I have no idea what to do to fix his problem just by CSS like what @PhilBroadbent mentioned.. because i have 3 dynamic grid inside my page and NOT every grid will have so many columns which needs a horizontal scrollbar.

Will it be fixed soon?

**** Updated **** image

The same issue happened in vertical scrollbar .. when both horizontal scrollbar and vertical scrollbar exist, and i drag the vertical scrollbar to the bottom of the grid, and it shows this layout issue..


But anyway, thanks a lot and really appreciate what you guys did on ui-grid.

applelok avatar Sep 08 '15 02:09 applelok

I'm also looking forward to WHEN_NEEDED. If that gets delayed, would at least be nice to not use inline styling on ui-grid-viewport (style="overflow: scroll;"). That is forcing me to hold my nose and use the !important flag in my css... .ui-grid-viewport { overflow: auto !important; }

mermonkey avatar Nov 20 '15 23:11 mermonkey

if i am use .ui-grid-viewport { overflow: auto !important; }

then i can see only 15 record where i am set limit 50 how get i get all record

Gajendrasinh avatar Jan 05 '16 05:01 Gajendrasinh

Yes. I was doing same... until i found this issue with pinned columns :( https://github.com/angular-ui/ui-grid/issues/4964

mermonkey avatar Jan 14 '16 22:01 mermonkey

Would there be a way to attach the scroll bars to the outside of the ui-grid box instead of within the container to eliminate the grid having to scroll past either the verticle/horizontal scroll bars to show all of the cells contents thus creating the slight mis-alignment with the headers and columns/rows

AnthonyTomlin avatar Feb 08 '16 20:02 AnthonyTomlin

A workaround for this is to set enableHorizontalScrollbar: 0 on your gridOptions and then in your stylesheet have the following:

.ui-grid .ui-grid-render-container-body .ui-grid-viewport {
    overflow-x: auto !important;
}

Now the horizontal scroll bar only displays when needed.

gethinoakes avatar Mar 07 '16 15:03 gethinoakes