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

UI Grid Menu is shifted out when grid has horizontal scrolling

Open dimetrym opened this issue 11 years ago • 4 comments

  • ui-grid - v3.0.0-rc.20 - 2015-02-24

Scroll grid horizontally to the last column and try to open grid menu for the last column. Menu appears but it is displayed under another column.

image

view demo: http://plnkr.co/edit/ArH7nYJoZd2f1wXbvoSC?p=preview

Thank you!

dimetrym avatar Feb 26 '15 12:02 dimetrym

OK, looks like it's also doing that on the all features tutorial. Not sure what's changed to break it, I'll take a look.

PaulL1 avatar Feb 26 '15 17:02 PaulL1

@swalters: would appreciate some advice here. If I go to the all features tutorial, and put a breakpoint in getColumnElementPosition, then I click on the rightmost column menu. It gets a positionData.left of 1200, which is presumably the leftmost border of the rightmost column. But if I step through the code, then step into repositionMenu, it has a containerScrollLeft of 1480. Everything goes wrong then, because we think the leftmost edge of the rightmost column is off screen to the left. The scroll code isn't really my thing - is this something that jumps out at you as having an obvious solution, or do I need to debug through it properly?

PaulL1 avatar Feb 27 '15 08:02 PaulL1

I've done a bisect, the breakage is caused by 893bb13e08c3c8fac9e886b5021777d752761c2d, which changed the header to table style.

Looking very carefully at the 401 all features tutorial, the e-mail column is the one that first displays the problem. If you scroll so it's to the right of the screen, and look at a breakpoint in getColumnElementPosition, it reports a left of 750, which is correct. If you scroll further so that the e-mail column is to the left of the grid, and click the column menu again, it reports an element left of 700 for the same element. The first column in the grid has a width of 50, so presumably the leftmost (ID) column has dropped out of the virtualisation and is no longer being computed in the width.

I can resolve this by adding also the offsetParent.offsetLeft, which in this case is 50. offsetParent looks to be well supported, so should be safe cross browser.

PaulL1 avatar Feb 28 '15 07:02 PaulL1

Hi, seems the issue still replicates on firefox, with a fewer columns it works fine but when the number of column goes beyond 10-12 it occurs. check the below snap: snap-uigrid the column menu displayed on some other column which was incorrect, using FF version-54.0, 64 bit

appjacker avatar Nov 13 '17 12:11 appjacker