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
jqGrid has double right border in forceFit state
02/03/2011
08:38
Avatar
enepomnyaschih
New Member
Members
Forum Posts: 1
Member Since:
02/03/2011
sp_UserOfflineSmall Offline

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 gridEl = $('<table id="grid-213487-1235" class="details-summary-grid"></table>');
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:

var curCoord = 0;
for (var i = 0; i < N; ++i)
{
     var nextCoord = curCoord + w[i];
     x[i] = Math.round(nextCoord) – Math.round(curCoord);
     curCoord = nextCoord;
}
Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information