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_TopicIcon
real height of the whole grid and a little tweak
26/04/2010
20:00
Avatar
fen
New Member
Members
Forum Posts: 1
Member Since:
26/04/2010
sp_UserOfflineSmall Offline

hi,

first please note that this is not a bug per se, but it appears like one. i wanted to fit the grid into it's surrounding div wrapper but as it turned out this was not that easy. simply setting the following code in the resize event of the wrapper div did not work very well.

$("#wrapper").bind("resize", function(){
  $("#table")
    .setGridHeight($(this).height())
    .setGridWidth($(this).width());
}).trigger("resize");

i recognized two things: first the height is not met. after a while i realized that this is really the grid height and not including the titlebar, etc, so i came up with the following work around:

  …
  var heightDelta = $(this).find(".ui-jqgrid").first().height() -
                    $(this).find(".ui-jqgrid-btable").first().getGridParam("height");
  $(this).find(".ui-jqgrid-btable").first()
    .setGridHeight($(this).height() - heightDelta)
    .setGridWidth($(this).width());
  …

what this does is to calculate the height of the complete grid which is embedded in the wrapper and subtract the grid height which the control tells us. this leaves us with the delta which represent the height everything else but the grid itself. the new grid height is then computed from the desired height minus the delta. it's really simple, but it took me  a while. is there any other way way? if not would it be possible to add a method which sets the 'outer' height of the grid instead only the grid height? inside jqgrid it must be relativly easy to calculate everything corretcly.

the second thing was about the width. i noticed that setting the grid's width using setGridWidth() often comes up with a horizontal scroller when i use the scroll=1 property on the grid (only tested in firefox) which is the result of the iframe width calculation.

you use the following code in grid.base.js around line 2150:

if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight){
    hs = true;
    aw -= scw;
}

i guess it's supposed to subtract the width of a vertical scrollbar if the full height of the iframe exceeds the visible height. the only problem is that firefox does not calculate the correct scrollHeight until it has been rendered. as a result the scrollHeight equals the clientHeight – which is wrong if you use the scroll=1 property. if one puts an alert box right before the if() the contents is forced to render and the calculation is correct. i'm not that in javascript or jquery that i can offer any workaround, but i guess it's fixable somehow. for now i put the following workaround in the modul which always calculates a vertical scroller if the scroll property is not false:

if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight || $t.p.scroll !== false){
    hs = true;
    aw -= scw;
}

this fixes the problem for me but is an incomplete solution.

please let me know if this has been already addressed or is work in progress.

cheers,

frank.

28/04/2010
23:48
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

I agree with fen. I have also some situation where wither width or height was wrong calculated. So I have to write a small fix. In http://stackoverflow.com/quest.....76#2696776 I posted this code.

With the height of jqGrid I have problem only in IE6. Mostly if my grid should has a horizontal scrolling its height was exactly one row too low.

With the width of jqGrid I have problems in following situation:

I have a block element (div) which tooks allways 100% or 98% of the page width. jqGrid is the child element of such block. I prefer to have no scrolling in the grid if parent block allow this. In my cases the width of all columns were allways exactly 5px too less as needed I one has horizontal scrolling which not needed. It seems a bug.

Other problem: the grid size which will be calculated by jqGrid can be set to the size larger as the parent block element (div). I verify whether the situation take place and then if needed reduce the jqGrid width. So user can scroll inside of the page, but he needs not scroll the page. (Horizontal scroll bar will have jqGrid abd not the web page).

Best regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
46 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