Forum


03:22

Moderators
30/10/2007

Hello,
Many times disscused - the answer is No.
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.
04:46

09/11/2009

I take that as a challenge
I'm getting closer: I can calculate an approximation of the width for a specific column by finding the width of, for example, the first cell:
<div id=”measure” style=”visibility:hidden”/>
and in loadComplete:
$('#measure').html('<span>' + $('#treegrid2 tbody tr:first td:eq(1)').text() + '</span>');
alert($('#measure span').width());
I realize that the cell selection should use getCell, but that always returns false for me, I'll keep poking at that. So how do I use this width value to set the width of a column after load? Between http://www.trirand.com/jqgridw.....;s=getcell I don't see anything that fits the bill.
10:11

Moderators
30/10/2007

Hello,
You should consider my answer NO as challenge too
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.
08:02

09/11/2009

I'm currently looking at something like this (call with resizeColumns('#yourgrid', ['colname1', 'colname2']):
var grid = $(id);
var cfgstring = grid.jqGridExport({'exptype': 'jsonstring'});
//var config = JSON.parse(cfgstring, function(k, v) { return v; });
eval('config = ' + cfgstring);
var rows = grid.getRowData();
var widths = new Array();
for (col in cols) {
colname = cols[col];
widths[colname] = 0;
}
for (rownum in rows) {
row = rows[rownum];
for (col in cols) {
colname = cols[col];
$('#measure').html('<span>' + row[colname] + '</span>');
w = $('#measure span').width();
if (w > widths[colname]) {
widths[colname] = w;
}
}
}
var colModel = config['grid']['colModel'];
for (col in colModel) {
if (colModel[col]['name'] in widths) {
colModel[col]['width'] = widths[colModel[col]['name']];
}
}
grid.jqGridImport({'imptype':'jsonstring', 'impstring':JSON.stringify(config)});
}
Currently, jqGridExport({'exptype': 'jsonstring'}) throws an error:
Source File: http://projecten.han-imao.nl:8000/agilito/js/jquery.jqgrid/js/jquery.jqGrid.min.js
Line: 10
I know the eval is stupid, but when I use JSON.parse I just get
Any clues appreciated.
00:31

Moderators
30/10/2007

Hello,
If you try this with FireFox 3.5 on Linux or FireFox and Safary on Mac there is a bug which is corrected - also it is not actually a bug in jqGrid, but in FireFox.
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.
Most Users Ever Online: 715
Currently Online:
75 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