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

Possible regression: horizontal scroll with pinning doesn't show last column(s)

Open c0bra opened this issue 11 years ago • 3 comments

Depending on the width of left-pinned columns, you cannot scroll to a certain number of the last columns in the main viewport. They are either cut off or completely hidden. This is probably because the scroll width is not being calculated properly, and was possibly introduced as a regression.

The horizontal scrollbar also now covers the totality of the grid width and not just the viewport to which it belongs. This may or may not be related but it's possible that the grid thinks it has more space to scroll horizontally than it really does, and the horizontal scrollbar would be a symptom of that.

Bisecting will probably be required to find the source.

c0bra avatar Dec 05 '14 21:12 c0bra

not sure how much this will help but heres how hacked around this problem: the width of the scrollbar content is currently set as the width of the body renderContainer canvas width:

//in updateNativeHorizontalScrollbar()
var w = colContainer.getCanvasWidth();
...
ret += '.grid' + grid.id + ' .ui-grid-render-container-' + containerCtrl.containerId + ' .ui-grid-native-scrollbar.horizontal .contents { width: ' + w + 'px; }';

however since the scrollbar spans all renderContainers -- in order for the scroll length to reflect a scroll length in just the body renderContainer the content needs to be pinnedLeftWidth + bodyCanvasWidth + pinnedRightWidth. I hacked this together and it seems to be alright

// in updateNativeHorizontalScrollbar()
var pinnedWidth = 0;
for(renderContainer in colContainer.grid.renderContainers) {
  if(renderContainer !== colContainer.name) {
      var cols = colContainer.grid.renderContainers[renderContainer].visibleColumnCache;
      var width = 0;

      for (var i = 0; i < cols.length; i++) {
        var col = cols[i];
        pinnedWidth += col.drawnWidth;
      }
  }
}

var w = colContainer.getCanvasWidth() + pinnedWidth;

the notable problem is that the scrollbar still spans the whole grid which looks a little funny but at least columns arent hidden

MeMea66 avatar Dec 12 '14 23:12 MeMea66

@c0bra: is this still happening for you with @swalters' latest changes?

PaulL1 avatar Jan 14 '15 21:01 PaulL1

I'm not able to make this happen any more, I don't think. Going to close and I'm sure if it's still a problem it will be opened as a new issue.

c0bra avatar Jan 29 '15 16:01 c0bra