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
Show at least one grid
23/11/2009
22:59
Avatar
Clement
Member
Members
Forum Posts: 48
Member Since:
30/03/2009
sp_UserOfflineSmall Offline

Hi,

I have two grids on a page: gridA and gridB, both height: 200 and visible onload. What I like it to do are:

1) At least one grid must be shown at any time.

2) If one grid is hidden, the height of the other is doubled to cover the space given up.

Steps to reproduce the only problem encountered:

1) Hide gridA -> gridA is hidden, gridB height: 400

2) Hide gridB -> gridB is hidden, gridA height: 400

3) Unhide gridB -> gridA height: 200, gridB height: still 400!

OR

1) Hide gridB -> gridB is hidden, gridA height: 400

2) Hide gridA -> gridA is hidden, gridB height: 400

3) Unhide gridA -> gridB height: 200, gridA height: still 400!

Have I missed anything? The following function is called in onHeaderClick for both grids. sourceGrid is the grid where header is clicked, targetGrid is the other grid.

      function setGridHeight(sourceGrid, sourceGridState, targetGrid){
        if(sourceGridState == “hidden”){
          sourceGrid.jqGrid('setGridHeight', 200); // Not working!
          // Grid#1 is hidden, increase height of grid#2 and unhide it if needed.
          targetGrid.jqGrid('setGridHeight', 400);
          if(targetGrid.jqGrid('getGridParam', 'gridstate') == “hidden”)
            targetGrid.jqGrid('setGridState', “visible”);
        }
        else{
          // Unhide grid#1, reset height of both grids.
          sourceGrid.jqGrid('setGridHeight', 200); // Not working!
          targetGrid.jqGrid('setGridHeight', 200);
        }
      }

Please advise.. Thank you!!

25/11/2009
11:12
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Making alerts after if and else  will give you the answer.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

25/11/2009
11:23
Avatar
Clement
Member
Members
Forum Posts: 48
Member Since:
30/03/2009
sp_UserOfflineSmall Offline

I did add alerts to check the new height which is supposed to be 200. The alerts show 200 but the physical height still appear as 400. Appreciate clarification if this is not what you refer to.. Thank you!

25/11/2009
12:07
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

My thoght was not only this, but how you pass the sourceGrid,  targetGrid - are they passed correct to the function?

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

25/11/2009
20:40
Avatar
Clement
Member
Members
Forum Posts: 48
Member Since:
30/03/2009
sp_UserOfflineSmall Offline

I think so since I do see grid height changes. The only cases where they do not work as expected are described in my first post. It works when you click to hide a grid but not when click to unhide, the unhidden grid height remains at 400 when viewed even though .jqGrid('getGridParam', 'height') reports 200.

gridA event -

onHeaderClick: function(stat){
    setGridHeight($("#gridA"), stat, $("#gridB"));

},

gridB event -

onHeaderClick: function(stat){
    setGridHeight($("#gridB"), stat, $("#gridA"));

},

27/11/2009
04:48
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Really forgot it, but you will need to use setTimeout to the grids that do not work.

This is connected maybe with this that the hidden element in jQuery has width and height = 0;

Regrads

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

27/11/2009
22:47
Avatar
Clement
Member
Members
Forum Posts: 48
Member Since:
30/03/2009
sp_UserOfflineSmall Offline

Thanks Tony, setTimeout works!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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