<?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: virtual scrolling - alternating rows / zebra strips out of synch after first page</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/virtual-scrolling-alternating-rows-zebra-strips-out-of-synch-after-first-page</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/virtual-scrolling-alternating-rows-zebra-strips-out-of-synch-after-first-page/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>de on virtual scrolling - alternating rows / zebra strips out of synch after first page</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/virtual-scrolling-alternating-rows-zebra-strips-out-of-synch-after-first-page#p24425</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/virtual-scrolling-alternating-rows-zebra-strips-out-of-synch-after-first-page#p24425</guid>
        	        	<description><![CDATA[<p>The alternating rows style class isn&#39;t applied correctly after the first page.<br />For example if the number of rows is 10 then row 10 (last row of first page) and row 11 (first page of 2nd page) will have the same style.</p>
<p>The fix seem to be in addXmlData/addJSONData (grid.base.js).</p>
<p>Near the beginning of addXmlData:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if($.isXMLDoc(xml)) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(ts.p.treeANode===-1 &#38;&#38; !ts.p.scroll) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;emptyRows(t,false, true);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;rcnt=1;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} else { <strong>rcnt = rcnt &#62; 1 ? rcnt :1;</strong> }<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} else { return; }</p>
<p>The fix is to change it to:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if($.isXMLDoc(xml)) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(ts.p.treeANode===-1 &#38;&#38; !ts.p.scroll) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;emptyRows(t,false, true);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;rcnt=1;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} else { <strong>rcnt = rcnt % 2;</strong> } // } else { rcnt = rcnt &#62; 1 ? rcnt :1; }<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} else { return; }</p>
<p>(the fix to addJSONData is very similar)</p>
<p>This way it isn&#39;t just setting rcnt to 0 for the first page and 1 from the 2nd page onwards. Instead it will set it to 0/1 depending on whether rcnt is odd or even. (Given that the number of rows on a page should usually be even it should be 0 though).</p>
]]></description>
        	        	<pubDate>Fri, 26 Aug 2011 16:44:48 +0300</pubDate>
        </item>
</channel>
</rss>