Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
fixing width of grid in showHideCol in case of shrinkToFit===true
19/05/2012
00:26
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

I described the problem with the fix ealy in the answer, but forgot to post it in the forum.

The problem is easy. The current code of showHideCol increase or decrease correctly the grid width only in case of shrinkToFit===false. In the code will be corrected adjusted the value of $t.p.tblwidth in the line, but the value will be just ignored in the following line.

To fix the problem I suggest modify the line

cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);

to the following

cw = this.widthOrg && $t.p.shrinkToFit ? this.widthOrg: parseInt(this.width,10);

and modify another line

$($t).jqGrid("setGridWidth",$t.p.shrinkToFit === true ? $t.p.tblwidth : $t.p.width );

to

$($t).jqGrid("setGridWidth", $t.p.tblwidth);

It's all the bug ifself. Another issue described in the answer is more the changing of behavior on the column resizing.

The resizeStop described in the answer

resizeStop: function () {
    var $grid = $(this.bDiv).find('>:first-child>.ui-jqgrid-btable:last-child'),
        shrinkToFit = $grid.jqGrid('getGridParam', 'shrinkToFit');
    $grid.jqGrid('setGridWidth', this.newWidth, shrinkToFit);
}

I use personally always since I wrote the answer. I like the behavior because I don't specify width parameter of the grid and want to hold the width of grid as the sum of the width of all columns. So it's logical to increase or decrease the width of the grid after resizing of the column. As the result one have grid which never have any horizontal scroll bar.

To make common solution from the above code one can just save the original value of the width parameter of the grid in for example orgWidth parameter. In the case one can test it inside of dragEnd (somewhere before calling of resizeStop) and do the same as above in case if orgWidth parameter converted to int is NaN.

Best regards
Oleg 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
47 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information