<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: jqGrid has double right border in forceFit state</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/jqgrid-has-double-right-border-in-forcefit-state</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/bugs/jqgrid-has-double-right-border-in-forcefit-state/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>enepomnyaschih on jqGrid has double right border in forceFit state</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/jqgrid-has-double-right-border-in-forcefit-state#p22275</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/jqgrid-has-double-right-border-in-forcefit-state#p22275</guid>
        	        	<description><![CDATA[<p>Reported in <a rel="nofollow" href="http://stackoverflow.com/questions/5102648/jqgrid-has-double-right-border-in-forcefit-state" target="_blank"></a><a href="http://stackoverflow.com/quest" rel="nofollow" target="_blank">http://stackoverflow.com/quest</a>.....efit-state and was redirected here.</p>
<p>I have jqGrid with forceFit property set to true. As result, right grid border sometimes solid, sometimes double. Screencast: <a rel="nofollow" href="http://screencast.com/t/KmkmGWAkh" target="_blank">http://screencast.com/t/KmkmGWAkh</a>.</p>
<p>I need solid border always.</p>
<p>Source code:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5226' value='Select Code' data-codeid='sfcode5226' /></p>
<div class='sfcode' id='sfcode5226'>var gridEl = $(&#39;&#60;table id=&#34;grid-213487-1235&#34; class=&#34;details-summary-grid&#34;&#62;&#60;/table&#62;&#39;);<br />var columns = [<br />&#160; &#160; &#160; &#160; {<br />&#160; &#160; &#160; &#160; &#160; &#160; label &#160; &#160; &#160; : &#34;Date&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; index &#160; &#160; &#160; : &#34;date&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; name &#160; &#160; &#160; &#160;: &#34;date&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; width &#160; &#160; &#160; : 140,<br />&#160; &#160; &#160; &#160; &#160; &#160; formatter &#160; : this._formatDate,<br />&#160; &#160; &#160; &#160; &#160; &#160; sorttype &#160; &#160;: &#34;int&#34;<br />&#160; &#160; &#160; &#160; }, {<br />&#160; &#160; &#160; &#160; &#160; &#160; label &#160; &#160; &#160; : &#34;Sender&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; index &#160; &#160; &#160; : &#34;sender&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; name &#160; &#160; &#160; &#160;: &#34;sender&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; formatter &#160; : function() { return<br />&#34;blablabla blablablabla blabla blablablabla blablabla blablabla blablablabla&#34;; }<br />&#160; &#160; &#160; &#160; }, {<br />&#160; &#160; &#160; &#160; &#160; &#160; label &#160; &#160; &#160; : &#34;Subject&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; name &#160; &#160; &#160; &#160;: &#34;subject&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; index &#160; &#160; &#160; : &#34;subject&#34;,<br />&#160; &#160; &#160; &#160; &#160; &#160; formatter &#160; : function() { return<br /> &#34;blablabla blablablabla blabla blablablabla blablabla blablabla blablablabla&#34;; },<br />&#160; &#160; &#160; &#160; &#160; &#160; width &#160; &#160; &#160; : 160<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; ];</p>
<p>gridEl.jqGrid({<br />&#160; &#160; datatype &#160; &#160;: &#34;local&#34;,<br />&#160; &#160; colModel &#160; &#160;: columns,<br />&#160; &#160; forceFit &#160; &#160;: true,<br />&#160; &#160; hidegrid &#160; &#160;: false,<br />&#160; &#160; rowNum &#160; &#160; &#160;: data.length,<br />&#160; &#160; height &#160; &#160; &#160;: &#34;100%&#34;<br />});</p>
<p>gridEl.jqGrid(&#39;addRowData&#39;, 0, data); // Does it matter that row ID is undefined?</p>
</div>
<p>Perhaps jqGrid just rounds floating-point widths of the columns and this bug takes place sometimes.</p>
<p>There is a simple way to fix floating-point ariphmetic imprecision.</p>
<p>If you have an array of floating-point widths [ w[0], &#8230; , w[N-1] ] such that (w[0] + &#8230; + w[N-1] = total, integer) then integer widths [ x[0], &#8230; , x[N-1] ]  can be found such that (x[0] + &#8230; + x[N-1] = total) the next way:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit438' value='Select Code' data-codeid='sfcode438' /></p>
<div class='sfcode' id='sfcode438'>var curCoord = 0;<br />for (var i = 0; i &#60; N; ++i)<br />{<br />&#160;&#160;&#160;&#160; var nextCoord = curCoord + w[i];<br />&#160;&#160;&#160;&#160; x[i] = Math.round(nextCoord) &#8211; Math.round(curCoord);<br />&#160;&#160;&#160;&#160; curCoord = nextCoord;<br />}</div>
]]></description>
        	        	<pubDate>Wed, 02 Mar 2011 08:38:54 +0200</pubDate>
        </item>
</channel>
</rss>