Forum


03:13

02/02/2009

Hi. I had recently discovered this very nice plugin. Solution for width of grid is interesting, but i wonder if there is any way how to archieve standard 100% width. Simply just stretch to full width in container, where grid is held.
I know that because of separated header from data it's not so easy, but is there any realiable way to make this ? Maybe i'm missing something obvious.
I tried simple solution for setting width of grid (using setGridWidth) to the $(grid).parent().parent().innerWidth() and binding to resize event of window for recalcalcute. That works fine in Firefox, but Internet Explorer (6.0) counts that width too later when there is grid already created and container has width computed from grid columns. Yes, i can get width before grid is created, but resizing window creates problem again.
05:14

02/02/2009

Well, i found a little dirty solution. If you know anything better, please let me know.
$(window).resize(function() {
$grid.setGridWidth(10,false);
$grid.setGridWidth( $grid.parent().parent().width(), true );
});
$(window).resize();
It simply resize grid width to 10px, so the container has right width and then grid is resized to that new width. It works fine, even resizing to 10px isn't visible, but it is “lagging” when i resize window. That's why i call it dirty
01:20

Moderators
30/10/2007

Hello,
I have never try this, but could you please try with setTimeout when in IE.
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.
03:51

02/02/2009

Well, this kinds of workarounds i really don't like. Giving a user longer time to wait than necessary. I was solving this way a lot of bugs in past, when i didn't understood problem, but it's essentially wrong
I was thinking about this and tried another approach. Whole think is wrapped to additional div which i hide (by display: none) on resize. Then IE then thinks, there is nothing and sets corrent width for container. Then i get it, set it and show back again. It seem a little bit cleaner, it's not even lagging, but there is visible resizing of this grid, because of that hiding and showing whole thing. Maybe on some faster computer it will not be so obvious. I tried also setting position of whole think to absolute and then back, but it's same result.
I don't know if there is better way. Initial display is not so much problem, it can be done in initialization time before table is transformed. You just get width of parent and if “width” option is set to 100% then set width of grid to that width of parent. But resizement problem still needs some hacking, so IE thinks there is nothing in there.
FredyC, you've touched a very actual problem, I think (and even saw on this forum) many users wishing, like me, to have the grid stretch the whole width of the container... Yeah, it's an old dilemma "resizable columns + scrollable tbody vs standard html-like table behaviour of 100% stretching".
Please keep us updated about your findings, meanwhile I'm going to experiment in a similar vein, if I find any decent solutions I will share as well...
Most Users Ever Online: 715
Currently Online:
87 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