Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

slickgrid resize causes scrollbar gap near bottom

I have the following problem: I use Slickgrid in combination with jquery layout. Panes can be resized with this plugin. When I resize the Slickgrid pane, so that a horizontal scrollbar appears, which wasn't there at first, I am unable to scroll all the way to the bottom.

I have created a jsfiddle to demonstrate: http://jsfiddle.net/uNMRT/2/

Steps to reproduce:

  1. make sure the slickgrid pane doesn't have a horizontal scrollbar.
  2. scroll all the way doen. (works nicely, you can view record 119, the last one)
  3. resize the slickgrid pane using the vertical splitter. Make sure to make the slickgrid area smaller to have a horizontal scrollbar appear.
  4. scroll all the way down again. Notice that you are unable to scroll completely down. Record 119 can't be seen now.

I already do a resizeCanvas upon resize:

center__onresize: function(pane, $pane, state, options) {
                myGrid.resizeCanvas();
            }

That's not enough obviously. Any ideas?

like image 438
Dittrich Avatar asked Nov 01 '12 13:11

Dittrich


2 Answers

I ran into the same issue and it seems like that slick grid does not set the "viewportHasHScroll" flag correctly. I found the following two workarounds to fix the issue (SlickGrid v2.1)

1) Update updateCanvasWidth function (line 396) and change the following line

viewportHasHScroll = (canvasWidth > viewportW - scrollbarDimensions.width); 

to (notice the "greater than or equal to" sign

viewportHasHScroll = (canvasWidth >= viewportW - scrollbarDimensions.width);

2) Update handleScroll function (line 1920) and update the if block

  //only scroll if they've moved at least one row
  if(vScrollDist && (vScrollDist > options.rowHeight)) {
      ....
  }
like image 70
Aman Mahajan Avatar answered Sep 28 '22 06:09

Aman Mahajan


I am facing the same issue but for vertical scroll. If the container is resized the vertical scroll bar does not scroll completely. It stops on the second last record. Although there is space for the bar to scroll it cannot be moved completely to the bottom. If I pull it down the grid jumps and the bar moves to the original position again. The last record can never be viewed.

like image 31
user1835093 Avatar answered Sep 28 '22 06:09

user1835093