Forum
08:38
02/03/2011
Reported in http://stackoverflow.com/quest.....efit-state and was redirected here.
I have jqGrid with forceFit property set to true. As result, right grid border sometimes solid, sometimes double. Screencast: http://screencast.com/t/KmkmGWAkh.
I need solid border always.
Source code:
var columns = [
{
label : "Date",
index : "date",
name : "date",
width : 140,
formatter : this._formatDate,
sorttype : "int"
}, {
label : "Sender",
index : "sender",
name : "sender",
formatter : function() { return
"blablabla blablablabla blabla blablablabla blablabla blablabla blablablabla"; }
}, {
label : "Subject",
name : "subject",
index : "subject",
formatter : function() { return
"blablabla blablablabla blabla blablablabla blablabla blablabla blablablabla"; },
width : 160
}
];
gridEl.jqGrid({
datatype : "local",
colModel : columns,
forceFit : true,
hidegrid : false,
rowNum : data.length,
height : "100%"
});
gridEl.jqGrid('addRowData', 0, data); // Does it matter that row ID is undefined?
Perhaps jqGrid just rounds floating-point widths of the columns and this bug takes place sometimes.
There is a simple way to fix floating-point ariphmetic imprecision.
If you have an array of floating-point widths [ w[0], … , w[N-1] ] such that (w[0] + … + w[N-1] = total, integer) then integer widths [ x[0], … , x[N-1] ] can be found such that (x[0] + … + x[N-1] = total) the next way:
for (var i = 0; i < N; ++i)
{
var nextCoord = curCoord + w[i];
x[i] = Math.round(nextCoord) – Math.round(curCoord);
curCoord = nextCoord;
}
Most Users Ever Online: 715
Currently Online:
41 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