<?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 and a4j combination causes a javascript error in firefox</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-and-a4j-combination-causes-a-javascript-error-in-firefox</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/help/jqgrid-and-a4j-combination-causes-a-javascript-error-in-firefox/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>mzazzali on jqGrid and a4j combination causes a javascript error in firefox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-and-a4j-combination-causes-a-javascript-error-in-firefox#p17760</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-and-a4j-combination-causes-a-javascript-error-in-firefox#p17760</guid>
        	        	<description><![CDATA[<p>I am using the tableToGrid method with jqGrid. &#160;It works well up until i tried to plug it into one of our jsf grids which is loaded through ajax via an a4j control. &#160;</p>
<p>version is 3.6.5</p>
</p>
<p>The problem was on line 1967 of the grid.base.js. &#160;The t.rows[0] was undefined and because of this cells was throwing an exception. &#160;Only the first row was being inserted into our grid and then the code exited out. &#160;</p>
<p>I also noticed that if I saved the generated source and used the tableToGrid method that the grid functioned as it should. &#160;It looks like it&#39;s something with the way the a4j component dynamically loads the new table into the dom.</p>
</p>
<p>I was able to get around this by adding a check to t.rows[0]. &#160;(However now I don&#39;t have sorting or movable columns). I do have the grid however.</p>
<p>/*if(!t.grid.cols &#124;&#124; !t.grid.cols.length) { t.grid.cols = t.rows[0].cells; }*/</p>
<p>if((!t.grid.cols &#124;&#124; !t.grid.cols.length)&#38;&#38;t.rows[0]) { t.grid.cols = t.rows[0].cells;</p>
<p>I admit I didn&#39;t spend a lot of time trying to figure out if the cols parameter was needed for anything. &#160;Is there a better way to handle this and is this a bug?</p>
</p>
<p>Update:</p>
<p>I stepped through the code some more and found out that on the ajax/a4j loaded tables the t.rows.length property is not updated after the row is added to the grid on line 1943. &#160;I compared this to the tables which are not loaded through ajax and the t.rows.length property is being updated.</p>
<p>Also when looking at the element in firebug $("table:first",t.grid.bDiv), the rows parameter on the first element are empty where on the non-ajax table I can see the first row being inserted. &#160;On both grids the row does show under the getfirstElementchild parameter. &#160;Which doesn&#39;t seem right to me.</p>
<p>&#160;This looks like the actual source of the problem. &#160;There must be something different about the structures of both tables that&#39;s causing the inconsistencies.</p>
</p>
<p>Update 06/07/2010:</p>
<p>I also managed to narrow this problem down to only firefox. &#160;It works in Chrome, ie7 and ie8. &#160;It&#39;s very strange that the append(row) on line 1943 of the grid.base.js file is not working properly.</p></p>
]]></description>
        	        	<pubDate>Fri, 04 Jun 2010 22:45:52 +0300</pubDate>
        </item>
</channel>
</rss>