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

Scrolling - column headers misaligned with data... #2592

Closed
cleon26 opened this issue Jan 19, 2015 · 41 comments
Closed

Scrolling - column headers misaligned with data... #2592

cleon26 opened this issue Jan 19, 2015 · 41 comments
Assignees
Milestone

Comments

@cleon26
Copy link

cleon26 commented Jan 19, 2015

Hey guys. I found a weird issue. I've been scratching my head with this one for a while trying to narrow it down. As best I can tell it's somehow related to the container size?

  1. Run this plnkr.
  2. Reduce the width of the right most column to about the size of the label "Company".
  3. Scroll the table to the right and everything looks fine.
    http://plnkr.co/edit/2gUnkzVdF1xvU9muNZ4K?p=preview
  4. Now run the plunker in embedded view.
  5. Reduce the width of the right most column to about the size of the label "Company".
  6. Scroll the table to the right and notice that the columns are misalgined with the headers.
    http://embed.plnkr.co/2gUnkzVdF1xvU9muNZ4K/preview

normal
embedded

@kjkurtz
Copy link

kjkurtz commented Jan 19, 2015

I have this same issue except it only occurs when horizontal scrolling. It initially shows up correctly.

@alexandery
Copy link

I could swear I've added an issue for this last week but I cannot find it anywhere?! Yeah, seems like there is some issue with the scrolling and the header getting out of sync with the columns.

@PaulL1
Copy link
Contributor

PaulL1 commented Jan 20, 2015

There was, I think, but I haven't recreated any issues with header misalignment for some time (since @swalters removed the throttling I think). On the plunkers provided above I don't get a misalignment, so perhaps it is somewhat OS or browser dependent?

@PaulL1 PaulL1 added this to the 3.0 milestone Jan 20, 2015
@alexandery
Copy link

@PaulL1 I get it on both IE9 and FF 35 (whatever is the latest as of today). And I do get it on Tutorial pages.

P.S. Funny enough - I submitted an issue for this mid last week but for the life of me cannot find it in the issues here. I had screenshots to showcase the issue. Weird.

@cleon26
Copy link
Author

cleon26 commented Jan 20, 2015

I can replicate it on IE11 and FF35.
And I swore that I could do it in Chrome39 yesterday as well, but am starting to doubt myself this morning.

@PaulL1
Copy link
Contributor

PaulL1 commented Jan 31, 2015

I'm trying to replicate today, and I cannot replicate on firefox on Linux, nor on Chrome.

When you say you scroll, is there some trick to the scrolling? I've tried trackpad on Chrome/OSX, and I've tried both dragging and using the scrollbar buttons on Firefox, neither are giving me a header misalignment.

@cleon26
Copy link
Author

cleon26 commented Jan 31, 2015

Nothing fancy... I can try again at work on Monday...

Sent from my iPad

On Jan 30, 2015, at 11:54 PM, Paul [email protected] wrote:

I'm trying to replicate today, and I cannot replicate on firefox on Linux, nor on Chrome.

When you say you scroll, is there some trick to the scrolling? I've tried trackpad on Chrome/OSX, and I've tried both dragging and using the scrollbar buttons on Firefox, neither are giving me a header misalignment.


Reply to this email directly or view it on GitHub.

@cleon26
Copy link
Author

cleon26 commented Feb 2, 2015

Just tried again this morning and can still replicate it in FF. Doesn't seem to matter whether I click the scroll button or drag the scroll bar.

image

@sachin-bs
Copy link

I am running into similar issues, tested in both IE11, FF30

image

image

@yugansh20
Copy link

Hi I am facing same issue.
When we scroll to the extreme right some of the columns are not reachable.
It will show 2nd last or 3rd last column as last column and I can see a very small part of the last column

@PaulL1
Copy link
Contributor

PaulL1 commented Feb 5, 2015

@yugansh20 : your issue sounds different, this issue is about the header being misaligned with the column, not columns being unreachable. If that is your issue, suggest raising that as a new issue along with a plunker that demonstrates it.

@sachin-bs
Copy link

any updates to this hi-pri bug?

@dczepierga
Copy link

I write quick fix for scroll here:
#2734 (comment)

Maybe this fix also help with this bug? (for me it works)

@c0bra
Copy link
Contributor

c0bra commented Feb 16, 2015

This is a dupe of #2521, leaving open.

c0bra added a commit that referenced this issue Feb 16, 2015
With the newer native scrollbar changes we need to subtract the scrollbar
width from the available width used to render the columns, otherwise the
viewport contents will overflow the visible area and cause the viewport to
scroll horizontally when we don't want it to.

Thanks to @dczepierga for tracking down the cause and solution.

Fixes #2521, #2734, #2592
@c0bra
Copy link
Contributor

c0bra commented Feb 16, 2015

Closed via cf86090

@c0bra c0bra closed this as completed Feb 16, 2015
@sachin-bs
Copy link

So a fix was made to align the column lines with the header lines but in the process a gap was introduced at the beginning of the grid...
alignmentnewerror

@nitoloz
Copy link

nitoloz commented Oct 21, 2015

This seems to reproduce even with the quite new release (3.0.7)
See image attached. Looks like the place the scroll takes is not counted when scrolling.
scroll

@dlypka59
Copy link

dlypka59 commented Nov 3, 2015

Workaround: non % values for width appear to work.

@nighojkarv
Copy link

I'm having the same issue but the other way. The left end of my grid is misaligned but as I scroll to the right, the grid gets aligned automatically.
grid-trouble

@dlypka59
Copy link

dlypka59 commented Dec 8, 2015

I solved it by not use % values for the column widths. Just use integer
units. Then the alignment is OK all the way on the scroll.

On Tue, Dec 8, 2015 at 4:14 PM, nighojkarv [email protected] wrote:

I'm having the same issue but the other way. The left end of my grid is
misaligned but as I scroll to the right, the grid gets aligned
automatically.
[image: grid-trouble]
https://cloud.githubusercontent.com/assets/11322165/11670300/1182a13a-9dcf-11e5-9a4e-f3bde44f3e5b.png


Reply to this email directly or view it on GitHub
#2592 (comment)
.

@nighojkarv
Copy link

I am using a fixed width of 150 on the columns, but still i'm getting the same issue.

@dlypka59
Copy link

dlypka59 commented Dec 8, 2015

remove any template in each column definition. The template if it is not
conforming to the various latest template standard can cause issues)

On Tue, Dec 8, 2015 at 4:26 PM, nighojkarv [email protected] wrote:

I am using a fixed width of 150 on the columns, but still i'm getting the
same issue.


Reply to this email directly or view it on GitHub
#2592 (comment)
.

@kalihos
Copy link

kalihos commented Apr 12, 2016

I have the same problem...

image

I'm not using percentages nor templates, except one for color choosing. I saw in other thread the same problem, caused by using enableHorizontalScrollbar:2 (not my case: I'm using value 1). I'm using Angular 1.4.9 and UI-Grid 3.0.7, with the latest Chrome version.

@angular-git-user
Copy link

Yes @dlypka59 it seems that % in not working anymore.... If we create column defs and do not add width property, then it is properly aligned within firefox but not in chrome. So I created my own col defs and plugged in width in pixels (ex. [{field:name, width:'100'}]) and it works fine.. (also tried with % but does not seem to allign, (ex. [{field:name, width:'15%'}]))

@SuprasannaBhaumik
Copy link

@nighojkarv , for your issue add this css rule in your custom class
.ui-grid-row{
clear: both;
}

@kalihos
Copy link

kalihos commented Sep 1, 2016

Hi!

Thanks for your reply. I tried your solution, but I've not been capable to
make it work. But it's possible that it were my fault, because my css
knowledge is very limited. I tried to include your code inside the "myGrid"
css tag, as I make with others. But I can't get it fine. I noticed that
other similar grid works correctly, so I think there can be another
problem. Thank you again!

2016-08-26 6:03 GMT+02:00 SuprasannaBhaumik [email protected]:

@nighojkarv https://github.com/nighojkarv , for your issue add this css
rule in your custom class
.ui-grid-row{
clear: both;
}


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2592 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APdPAFpBvLnm9W2-jLYF2rsQRTWvbE4Tks5qjmWSgaJpZM4DUWLH
.

@robs15
Copy link

robs15 commented Sep 19, 2016

gridcrop

I still have this issue on ver. 3.2.7.

Using the following options :
exporterMenuPdf: false,
enableRowSelection: true,
enableRowHeaderSelection: false,
multiSelect: false,
enableSorting: true,
enableFiltering: true,
//enableGridMenu: true,
enableColumnResizing: true,
enableHorizontalScrollbar: true,
enableVerticalScrollbar: true,
paginationPageSizes: [10, 20, 30],
paginationPageSize: 10,

The columns are set to pixel widths. No width or height style set to the overall grid.

@mesutd0nmez
Copy link

Hey guys, i had same problem. I searched a code like below, and it worked for me. Try it.

.ui-grid-header-cell {float: left;}

@antonio91kim
Copy link

antonio91kim commented Dec 16, 2016

Hope everyone can solve this problem with this tip.
my idea is making an empty box beside last column header.

First, add class on last column header when vertical scrollbar needed.
This code should be executed on gridApi.core.on.renderingComplete event.

// if horizontal scrollbar needed, add class on last column
if (gridApi.grid.options.data.length > 7)
  gridApi.grid.options.columnDefs[gridApi.grid.options.columnDefs.length - 1].headerCellClass = 'include-scrollbar';

And add below lines on style sheet. Assume that scroll width is 20px.

.ui-grid-header-cell.include-scrollbar:last-child .ui-grid-cell-contents {
  margin-right: -20px;
  padding-right: 20px;
}

@ginz
Copy link
Contributor

ginz commented Feb 23, 2017

@mesutd0nmez That works!

@kenaths
Copy link

kenaths commented Mar 10, 2017

Set enableVerticalScrollbar to true, It'll fix the issue.

        $scope.gridOptions = {
            enableVerticalScrollbar: 1,
            ..............
        }

@prashasti4
Copy link

I Fixed it by rounding of the header column min and max width in following function:
r.prototype.getColClassDefinition = function() {
//round of the values
return " .grid" + this.grid.id + " " + this.getColClass(!0) + " { min-width: " + Math.round(this.drawnWidth) + "px; max-width: " + Math.round(this.drawnWidth) + "px; }"
}

@FizzBuzz791
Copy link

This is still an issue in version 4.6.0
I had to fix it by using @kenaths approach... Should not be necessary.

@kalihos
Copy link

kalihos commented Jul 6, 2018 via email

@kalihos
Copy link

kalihos commented Jul 27, 2018 via email

@mportuga
Copy link
Member

mportuga commented Jul 27, 2018

This was closed by a pull request that just got merged in. It will be in the next release of ui-grid. I will try to release it this weekend so that you can have it ASAP and if it does not work for some reason, then we can reopen it.

@kalihos
Copy link

kalihos commented Jul 27, 2018 via email

defields923 pushed a commit to defields923/ui-grid that referenced this issue Oct 30, 2018
* Change grid header css to flexbox

Change grid header css to be flexbox based

Header display properties was previously table based while body is block based. This causes alignment issues in some cases.

* Better spacing

* Another space

Fix angular-ui#6799, Fix angular-ui#2592
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests