tonytomov / jqGrid

jQuery grid plugin

Home Page:www.trirand.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horizontal scroll not working properly

unle70 opened this issue · comments

commented

Hi Tony,

I'm seeing something very strange and perhaps you can give a tip on how to debug it further. My environment is slightly complicated to replicate, so I hope my description would be good enough to understand.

If I place a grid inside a jquery-ui dialog (for creating a pop-up window) and that grid is a little wide, with "shrinkToFit" set to "false", I'm getting a problem where the bdiv can be moved left and right, but the hdiv remains in place. There's also a more minor issue where upon creation of this grid, both the hdiv and bdiv are scrolled to the right about 5px. I can then manually scroll the bdiv, but as said, the hdiv remains fixed in place.

I started debugging this issue by myself and got to the "scrollGrid:" section of jqGrid (line #2388 in the full code).

scrollGrid: function() {
	if(!grid.bScroll) {
		grid.hScroll  = true;

I tried to manually set bScroll to "false" in the "gridComplete" event and then the scrolling problem is fixed. the hdiv starts moving together with the bdiv. The other issue (initial shift to the right) still remains.

I'm wondering if you could have any clue for why this is happening only when the grid is inside a dialog.
Is it possible that you were using the "on-scroll" event for determining that the content is larger than the viewport, but for some reason this event is not triggering when inside the dialog?

Hello Udi,

Can be anything. Without demo for me is not possible to diagnose the problem.
Also all other grid options are important and any of them can cause the problem (not only shrinkToFit)

If possible prepare a working demo.

Maybe you can check the colModel, and data for cosistency, but I do not know if you have repeatitems to true or you use xml data and etc.

You know what I mean.

Regards
Tony

commented

Hi Tony,

Well, eventually I found MY mistake.
As you said, more settings were involved. I am using "autoWidth: false" in my environment and then calling "setWidth" (and "setHeight") manually when needed.

My grid was being added to the dialog when the dialog was "closed" (hidden) and then my calculated setWidth was setting a NEGATIVE number as the desired width.
After the dialog was "opened" for viewing, I called setWidth again with a correct number, but due to the previous negative number, something went very wrong and the headings would not move anymore.

After making sure I never call setWidth with negative numbers, all is working fine now.

commented

Hi Tony,

Well, eventually I found MY mistake.
As you said, more settings were involved. I am using "autoWidth: false" in my environment and then calling "setWidth" (and "setHeight") manually when needed.

My grid was being added to the dialog when the dialog was "closed" (hidden) and then my calculated setWidth was setting a NEGATIVE number as the desired width.
After the dialog was "opened" for viewing, I called setWidth again with a correct number, but due to the previous negative number, something went very wrong and the headings would not move anymore.

After making sure I never call setWidth with negative numbers, all is working fine now.