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

resizing column with pinned column broke table

Open brainsbucket opened this issue 12 years ago • 2 comments

(First thanks for your great work !) When you pin a column (to the left) and then increase the size of it, then the not pinned columns go under the pinned columns. you can try it on the tutoriel : http://ui-grid.info/docs/#/tutorial/401_AllFeatures

brainsbucket avatar Nov 20 '14 07:11 brainsbucket

I noticed this bug as well -- I dug around a little bit: the crux of the problem has to do with this comment in uiGridPinningService:

//in uiGridPinningService:
// Need to call refresh twice; once to move our column over to the new render container and then
//   a second time to update the grid viewport dimensions with our adjustments
    col.grid.refresh()
    .then(function () {
        col.grid.refresh();
    });
//in uiGridColumnResizer:
   uiGridCtrl.grid.buildColumns()
       .then(function() {
              // Then refresh the grid canvas, rebuilding the styles so that the scrollbar updates its size
              uiGridCtrl.grid.refreshCanvas(true);
    });

inside the uiGridColumnResizer in the buildColumnsAndRefresh function the canvas is only refreshed once. If you refresh the grid twice as in the pinning service it works fine. I am not sure how performant this is or whether this is a sustainable solution (you would have to refresh twice anytime something changes the widths of the pinned container.

MeMea66 avatar Dec 12 '14 22:12 MeMea66

I've applied the fix as suggested. This does refresh twice, but only for people using resize, and only when the user manually resizes (i.e. not that frequently). I don't think the performance overhead will be material.

PaulL1 avatar Jan 16 '15 06:01 PaulL1