Forum
18:12
09/11/2009
If "scrolloffset = 0" and "autowidth=true" then I have an horizontal scrollbar.
If I don't want of that horizontal scrollbat then I must suppress "scrolloffset=0"
But ...
If the grid is empty or not full then there is a shift between the headers and the columns (already invoked in other threads)
Is is a dilemma or does a solution exist ?
13:10
Moderators
30/10/2007
Hello,
Currently no. I understand what you mean.
Also one possible solution is to set height:'auto', which will resolve your problems.
Best 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.
17:48
Moderators
30/10/2007
Hello,
For now no, but you can analyze the number of columns in loadComplete and set the height to auto or to some value
something like
if(rowcounr>10) set grid height to auto
else set the grid height to 200px
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.
20:29
Moderators
30/10/2007
Hello,
Try this
if (r <= 6)
{
jQuery("#list1″).setGridHeight('auto')
}
else
{
jQuery("#list1″).setGridHeight(150)
}
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.
13:08
09/11/2009
It's not suffisant: scrolloffset should be set to 0 (I think ...)
But It doesn't work ! with and without the trigger !!
if (r <= 6)
{
jQuery("#list1″).setGridHeight('auto');
jQuery("#list1").setGridParam({'scrollOffset':0}).trigger("reloadGrid"); <<<<<<<<<<<<<<<<<<<
}
else
{
jQuery("#list1″).setGridHeight(150)
//HOW TO SET SCROLLOFFSET TO DEFAULT ?
}
08:55
Moderators
30/10/2007
Hello,
The trick is to change the width with 1 pixel ,
using trigger("reloadGrid") is not needed.
if (r <= 6)
{
var wd = .. get here the width of the grid
jQuery("#list1″).setGridHeight('auto');
jQuery("#list1″).setGridwidth(wd+1);
}
.......
Best 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.
12:27
09/11/2009
I think we have a misunderstanding because your trick has no effect .
I always have an horizontal scrollbar if r > 6 !!!!!!!
I only want a vertical scrollbar if r > 6
loadComplete: function ()
{
var r = jQuery("#list1").getGridParam('reccount');
if (r <= 6)
{
jQuery("#list1").setGridHeight('auto');
var w = jQuery("#list1").getGridParam('width');
alert(w);
jQuery("#list1").setGridWidth(w+1);
}
else
{
jQuery("#list1").setGridHeight(150) ; <<<<<<<<<<<< horizontal scrollbar !!!!!!
}
},
13:03
Moderators
30/10/2007
Hello,
Forgot to say that the setGridwidth should be set on both
Try this
loadComplete: function ()
{
var r = jQuery("#list1″).getGridParam('reccount');
var w = jQuery("#list1″).getGridParam('width');
if (r <= 6)
{
jQuery("#list1″).setGridHeight('auto');
alert(w);
}
else
{
jQuery("#list1″).setGridHeight(150) ; <<<<<<<<<<<< horizontal scrollbar !!!!!!
}
jQuery("#list1″).setGridWidth(w+1);
},
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.
19:24
09/11/2009
Yes, but I shall remove scrollOffset=0
The final code is:
loadComplete: function ()
{
var r = jQuery("#list1").getGridParam('reccount');
var w = jQuery("#list1").getGridParam('width');
if (r <= 6)
{
jQuery("#list1").setGridHeight('auto');
}
else
{
jQuery("#list1").setGridHeight(150);
}
jQuery("#list1").setGridWidth(w+1);
},
Thank you for your patience.
19:46
09/11/2009
The method is perfect … but only with one grid !
If you have two grids, the second doesn't change its height but "follows" the fiirst grid !
first grid:
loadComplete: function ()
{
var r = jQuery("#list1″).getGridParam('reccount');
var w = jQuery("#list1″).getGridParam('width');
if (r <= 12)
{
jQuery("#list1″).setGridHeight('auto');
}
else
{
jQuery("#list1″).setGridHeight(100);
}
jQuery("#list1″).setGridWidth(w+1);
}
second grid:
loadComplete: function ()
{
var r = jQuery("#list2″).getGridParam('reccount');
var w = jQuery("#list2″).getGridParam('width');
if (r <= 12)
{
jQuery("#list2″).setGridHeight('auto');
}
else
{
jQuery("#list2″).setGridHeight(350);
}
jQuery("#list2″).setGridWidth(w+1);
}
Then the height of the second grid will be 100 instead of 350 !
I also tried with r1=... and r2=... idem for w1,w2
Do you see the error ?
18:08
Moderators
30/10/2007
Hello,
I do not see any error in the script, but I suppose this is not the original script - right?
Please check your script again.
Best 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.
12:09
Moderators
30/10/2007
Hello,
Ok. Will check it.
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.
18:30
09/11/2009
I found this solution but it's not elegant !!!!!
first grid:
loadComplete: function ()
{
var r = jQuery("#list1″).getGridParam('reccount');
var w = jQuery("#list1″).getGridParam('width');
if (r <= 12)
{
jQuery("#list1″).setGridHeight('auto');
jQuery("#list1″).setGridHeight(100); <<<<<<<<<<<<<<
}
else
{
jQuery("#list1″).setGridHeight(100);
}
jQuery("#list1″).setGridWidth(w+1);
}
second grid:
loadComplete: function ()
{
var r = jQuery("#list2″).getGridParam('reccount');
var w = jQuery("#list2″).getGridParam('width');
if (r <= 12)
{
jQuery("#list2″).setGridHeight('auto');
jQuery("#list2″).setGridHeight(350); <<<<<<<<<<<<<<<<<
}
else
{
jQuery("#list2″).setGridHeight(350);
}
jQuery("#list2″).setGridWidth(w+1);
}
Most Users Ever Online: 715
Currently Online:
29 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66