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

moveColumn service works incorrectly if user pins a column

Open MeMea66 opened this issue 11 years ago • 4 comments

go to http://ui-grid.info/docs/#/tutorial/401_AllFeatures pin a column to the left (ie address.street) try to move a column after its original position (like address.city) the wrong column gets moved.

or move a column before its original position (like name) and the column gets moved to the wrong position

I havent looked into this very deeply but I think it is because of how the number of columns hidden by scroll is calculated:

var renderedColumns = $scope.grid.renderContainers['body'].renderedColumns;

//This method will calculate the number of columns hidden in lift due to scroll
//renderContainer.prevColumnScrollIndex could also have been used but this is more accurate
var scrolledColumnCount = 0;
var columns = $scope.grid.columns;
for (var i = 0; i < columns.length; i++) {
  if (columns[i].colDef.visible && columns[i].colDef.name !== renderedColumns[0].colDef.name) {
    scrolledColumnCount++;
  }
  else {
    break;
  }
}

renderedColumns doesnt include the pinned columns but grid.columns does so all columns pinned are automatically considered "hidden columns"

MeMea66 avatar Dec 13 '14 00:12 MeMea66

@jpuri: have you seen this one?

PaulL1 avatar Dec 13 '14 21:12 PaulL1

Hi @MeMea66 ,

Thanks for bringing this up. I will look into this.

jpuri avatar Dec 15 '14 04:12 jpuri

PR #2351 should fix the issue.

jpuri avatar Dec 15 '14 11:12 jpuri

No response after 2 weeks; assuming problem was fixed. Closing.

c0bra avatar Dec 29 '14 15:12 c0bra