angular-ui/ui-grid

When restoring scrollFocus, a row that was previously on top, is now on the bottom of grid

クローズ

#5,911 opened on 2016/12/22

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (2,496 件のフォーク)batch import
help wanted

Repository metrics

Stars
 (5,395 個のスター)
PR merge metrics
 (PR metrics pending)

説明

I have a grid that's sitting inside a non-modal, I use saveState so I can destroy and recreate the grid.

I'm expecting the row that was the first row to be at the top when restoring, however it appears on the bottom of the grid.

I looked around in ui-grid.js (4.0.1), and noticed that in Grid.prototype.scrollIfNecessary when calculating the "scrollPixels", you deduct(-) the "bottomBound".

If I replace the bottomBound with my rowHeight, I get the expected result.

I might be doing something wrong, but if not, a fix is needed.

EDIT: The issue occurs only when the row that was before on top is below the current view port when restoring the state, as in - pixelsToSeeRow > bottomBound, This is happening in http://ui-grid.info/docs/#/tutorial/208_save_state as well

コントリビューターガイド