<?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: grid base code simplification</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification</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/grid-base-code-simplification/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>markw65 on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p14015</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p14015</guid>
        	        	<description><![CDATA[<p>While debugging another issue, I was using Fiddler to track network events for my page.</p>
</p>
<p>I noticed that in ie6 and ie7, if you wave the mouse in front of a grid, /lots/ of network events fire. And they&#39;re all fetching the same background image.</p>
</p>
<p>I googled around a bit, and found that ie6 has a known bug where setting the background image of an element will cause "flicker", because it fetches the image from the server (regardless of caching setting). The bug is supposedly fixed in ie7.</p>
</p>
<p>Well, the flicker may be fixed, but fetching the background image certainly isnt. Also, the well documented fix for ie6 &#39;document.execCommand("BackgroundImageCache",false,true)&#39; doesnt seem to stop the traffic with either ie6 or ie7.</p>
</p>
<p>Not sure what can be done, except to minimize the changes - so rather than changing the css on every mouseover and mouseout, we should verify that the row has actually changed. That would certainly cut down on the traffic...</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Tue, 19 Jan 2010 00:43:32 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13399</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13399</guid>
        	        	<description><![CDATA[<p>The ideal solution would be to use the css pseudo class :hover in all browsers that support it (ie everything except ie6), and not have the event handlers at all for most browsers.</p>
</p>
<p>Unfortunately, you cant do that and stay compatible with themeroller, as far as I can tell (this seems to be a flaw with jquery-ui/themeroller).</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Mon, 28 Dec 2009 23:59:02 +0200</pubDate>
        </item>
        <item>
        	<title>tony on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13396</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13396</guid>
        	        	<description><![CDATA[<p>Mark,</p>
<p>Thank you. To be a honest I look at other side which IMHO is not the right one. You explain it very good, but the problem persisst and it can be seen very well in IE6. Also the change is rolled back until we found a better solution.</p>
<p>Thanks again</p>
<p>Tony</p></p>
]]></description>
        	        	<pubDate>Mon, 28 Dec 2009 23:17:15 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13393</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13393</guid>
        	        	<description><![CDATA[<p>This last change doesnt look safe - ptr is set by code other than mouseover, so may be pointing at something other than the hover row. That could be fixed by using a different variable (eg hover_row). (Perhaps you did this - I dont see the change in github yet).</p>
</p>
<p>But, I think there is a bigger issue.</p>
</p>
<p>Every time the mouse moves from one sub-element of a row to another sub-element of a row, we get both a mouseout and a mouseover, and so the above code (even after the changes) removes and re-adds the class.</p>
</p>
<p>This will happen eg when moving from one td to another in the same row. But for grids whose cells have complex contents could be happening *a lot* within a single td.</p>
</p>
<p>I think the code as it stands is "correct" (Im assuming the mouseout is guaranteed to come before the mouseover, but havent checked that that is the case), but is certainly going to fire far too often.</p>
</p>
<p>It seems like you could check whether relatedTarget and target are contained in the same row, and only add/remove the class when the row actually changes.</p>
</p>
<p>That would somewhat negate the above change - because now you do two "closest" calls per mouseover/mouseout. But I suspect that most of the time is spent in adding/removing the class (because it causes the document to reflow).</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Mon, 28 Dec 2009 21:08:08 +0200</pubDate>
        </item>
        <item>
        	<title>tony on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13388</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13388</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks. Fixed.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 28 Dec 2009 19:31:08 +0200</pubDate>
        </item>
        <item>
        	<title>Les on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13385</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13385</guid>
        	        	<description><![CDATA[<p>I noticed that row mouseover can be slow. &#160;I think this code can be further simplified:</p>
</p>
<p><span> </span>$(ts).bind(&#39;mouseover&#39;,function(e) {<span> </span></p>
<p><span> </span>ptr = $(e.target).closest("tr.jqgrow");<span> </span></p>
<p><span> </span>if(!ptr.hasClass("subgrid")) {</p>
<p><span> </span>ptr.addClass("ui-state-hover");</p>
<p><span> </span>}<span> </span></p>
<p><span> </span>return false;</p>
<p><span> </span>}).bind(&#39;mouseout&#39;,function(e) {<span> </span></p>
<p><span> </span>ptr.removeClass("ui-state-hover");</p>
<p><span> </span>return false;</p>
<p><span> </span>});</p>
]]></description>
        	        	<pubDate>Mon, 28 Dec 2009 19:15:09 +0200</pubDate>
        </item>
        <item>
        	<title>Les on grid base code simplification</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13383</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/grid-base-code-simplification#p13383</guid>
        	        	<description><![CDATA[<p>I wanted to point out that the following code fragment can be simplified:</p>
</p>
<p>// current</p>
</p>
<p>$(ts).bind(&#39;mouseover&#39;,function(e) {<span> </span></p>
<p><span> </span>ptr = $(e.target).closest("tr.jqgrow");</p>
<p><span> </span>if($(ptr).attr("class") !== "subgrid") {</p>
<p><span> </span>$(ptr).addClass("ui-state-hover");</p>
<p><span> </span>}<span> </span></p>
<p><span> </span>return false;</p>
<p>}).bind(&#39;mouseout&#39;,function(e) {<span> </span></p>
<p><span> </span>ptr = $(e.target).closest("tr.jqgrow");</p>
<p><span> </span>$(ptr).removeClass("ui-state-hover");</p>
<p><span> </span>return false;</p>
<p>});</p>
</p>
<p>// new</p>
</p>
<p><span> </span>$(ts).bind(&#39;mouseover&#39;,function(e) {<span> </span></p>
<p><span> </span>ptr = $(e.target).closest("tr.jqgrow");</p>
<p><span> </span>if(ptr.attr("class") !== "subgrid") {</p>
<p><span> </span>ptr.addClass("ui-state-hover");</p>
<p><span> </span>}<span> </span></p>
<p><span> </span>return false;</p>
<p><span> </span>}).bind(&#39;mouseout&#39;,function(e) {<span> </span></p>
<p><span> </span>ptr = $(e.target).closest("tr.jqgrow");</p>
<p><span> </span>ptr.removeClass("ui-state-hover");</p>
<p><span> </span>return false;</p>
<p><span> </span>});</p>
</p>
<p>There is no need to again do $(ptr)</p>
]]></description>
        	        	<pubDate>Mon, 28 Dec 2009 18:45:27 +0200</pubDate>
        </item>
</channel>
</rss>