<?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: Formatter rowObject is not object</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object</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/formatter-rowobject-is-not-object/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>OlegK on Formatter rowObject is not object</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21362</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21362</guid>
        	        	<description><![CDATA[<p>Sorry AndzinSan,</p>
<p>do you read <a href="http://stackoverflow.com/questions/4485970/jqgrid-rowobject-inconsistencies/4486142#4486142" target="_blank">the link</a>&#160;which I posted you before? It answers&#160;<strong>exactly</strong> on your question. My suggestion was to use <a href="http://api.jquery.com/jQuery.isArray/" target="_blank">$.isArray</a>:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3492' value='Select Code' data-codeid='sfcode3492' /></p>
<div class='sfcode' id='sfcode3492'>function torrentReq(value, options, rowObject)<br /> {<br />&#160;&#160; &#160;var requestName,requestID;<br />&#160;&#160; &#160;if ($.isArray(rowObject)) {<br />&#160;&#160; &#160; &#160; &#160;// access per array. We are currently in the initial grid filling<br />&#160;&#160; &#160; &#160; &#160;requestID = rowObject[1];<br />&#160;&#160; &#160; &#160; &#160;requestName = rowObject[2];<br />&#160;&#160; &#160;} else {<br />&#160;&#160; &#160; &#160; &#160;// access properties. The datatype is now &#39;local&#39;<br />&#160;&#160; &#160; &#160; &#160;requestID = rowObject.request_id;<br />&#160;&#160; &#160; &#160; &#160;requestName = rowObject.requestname;<br />&#160;&#160; &#160;}<br />&#160;&#160; &#160;var reqLink = (requestName) ? &#39;&#60;br&#62;&#60;span id=&#34;request-link-&#39;+requestID+<br />&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#39;&#34; class=&#34;ui-request- &#160; &#160;link&#34;&#62;&#39;+requestName+&#39;&#60;/span&#62;&#39; : &#39;&#39;;<br />&#160;&#160; &#160;return &#39;&#60;span&#62;&#39;+value+&#39;&#60;/span&#62;&#39;+reqLink;<br /> }</div>
<p>Moreover you <span style="text-decoration: underline;"><em>has already another working version</em></span> which based on the same idea! Why you then ask the question and I spend me time in answering it?</p>
<p>Oleg</p>
]]></description>
        	        	<pubDate>Mon, 20 Dec 2010 18:27:55 +0200</pubDate>
        </item>
        <item>
        	<title>AndzinSan on Formatter rowObject is not object</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21358</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21358</guid>
        	        	<description><![CDATA[<p>Here is the complete source:</p>
<blockquote>
<p>function unformat(cellvalue, options, cellobject)</p>
<p>{</p>
<p>}</p>
<p>function torrentReq(value, options, rowObject)</p>
<p>{</p>
<p>var requestName = (!rowObject[2]) ? rowObject[&#39;requestname&#39;] : rowObject[2];</p>
<p>var requestID = (!rowObject[1]) ? rowObject[&#39;request_id&#39;] : rowObject[1];</p>
<p>var reqLink = (requestName) ? &#39;&#60;br&#62;&#60;span id="request-link-&#39;+requestID+&#39;" class="ui-request-link"&#62;&#39;+requestName+&#39;&#60;/span&#62;&#39; : &#39;&#39;;</p>
<p>return &#39;&#60;span&#62;&#39;+value+&#39;&#60;/span&#62;&#39;+reqLink;</p>
<p>}</p>
<p>var torrentGrid = $("#tab-content-torrents").jqGrid({</p>
<p>url:&#39;./json?{{G:AJAX_DATAS_TABLE}}&#39;,</p>
<p>datatype: "json",</p>
<p>mtype:&#39;POST&#39;,</p>
</p>
<p>loadonce: true,</p>
<p>colNames:[&#39;id&#39;,&#39;rid&#39;, &#39;rname&#39;,&#39;catname&#39;,&#39;firstcom&#39;,&#39;ttlhave&#39;,&#39;&#39;,</p>
<p>&#39;&#60;span&#62;{{Lng:Torrent}}&#60;/span&#62;&#39;,&#39;&#60;span&#62;{{Lng:Added}}&#60;/span&#62;&#39;,&#39;&#60;span&#62;{{Lng:Size}}&#60;/span&#62;&#39;,</p>
<p>&#39;&#60;span&#62;{{Lng:TTLends}}&#60;/span&#62;&#39;,&#39;&#60;span&#62;{{Lng:TTL}}&#60;/span&#62;&#39;,</p>
<p>&#39;&#60;div class="ui-icon ui-icon-comment" style="float:left;"&#62;&#60;/div&#62;&#39;,</p>
<p>&#39;&#60;div class="ui-icon ui-icon-circle-check" style="float:left;"&#62;&#60;/div&#62;&#39;,</p>
<p>&#39;&#60;div class="ui-icon ui-icon-check" style="float:left;"&#62;&#60;/div&#62;&#39;,</p>
<p>&#39;&#60;div class="ui-icon ui-icon-arrowreturnthick-1-n" style="float:left;"&#62;&#60;/div&#62;&#39;,</p>
<p>&#39;&#60;div class="ui-icon ui-icon-arrowreturnthick-1-s" style="float:left;"&#62;&#60;/div&#62;&#39;,</p>
<p>&#39;&#60;span&#62;{{Lng:TVS}}&#60;/span&#62;&#39;],</p>
<p>colModel:[</p>
<p>{name:&#39;id&#39;,index:&#39;id&#39;,align:&#39;right&#39;,width:55,fixed:true,search:false,sorttype:"int",},</p>
<p>{name:&#39;request_id&#39;,index:&#39;request_id&#39;, width:40,fixed:true,sorttype:"int",hidden:true,},</p>
<p>{name:&#39;requestname&#39;,index:&#39;requestname&#39;, width:100,fixed:true,hidden:true,},</p>
</p>
<p>{name:&#39;categoryname&#39;,index:&#39;categoryname&#39;, width:80,fixed:true,},</p>
</p>
<p>{name:&#39;first_new_comment&#39;,index:&#39;first_new_comment&#39;, width:50,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;ttl_have&#39;,index:&#39;ttl_have&#39;, width:50,fixed:true,},</p>
</p>
<p>{name:&#39;specialcategory&#39;,index:&#39;specialcategory&#39;, width:50,fixed:true,search:false},</p>
<p>{name:&#39;torrentname&#39;,index:&#39;torrentname&#39;, width:550,fixed:true,</p>
<p>formatter:torrentReq,</p>
<p>unformat:unformat,},</p>
<p>{name:&#39;added&#39;,index:&#39;added&#39;,align:&#39;center&#39;,width:200,fixed:true,</p>
<p>searchoptions:{</p>
<p>dataInit:function(el)</p>
<p>{</p>
<p>$(el).datepicker({dateFormat:&#39;yy-mm-dd&#39;,</p>
<p>changeMonth: true,</p>
<p>changeYear: true</p>
<p>});</p>
<p>},</p>
<p>dataEvents: [{type: &#39;change&#39;,</p>
<p>fn: function(e)</p>
<p>{</p>
<p>torrentGrid[0].triggerToolbar();</p>
<p>}</p>
<p>}]</p>
<p>},</p>
<p>formatter:"date",</p>
<p>formatoptions:{srcformat:"Y-m-d H:i:s",newformat:"{{U:DatetimeFormat}}"},</p>
<p>unformat:unformat,</p>
<p>},</p>
<p>{name:&#39;size&#39;,index:&#39;size&#39;, width:100,fixed:true,align:&#39;right&#39;,sorttype:"int",search:false,</p>
<p>formatter:readableBytes,</p>
<p>formatoptions:{},</p>
<p>unformat:unformat,</p>
<p>},</p>
<p>{name:&#39;ttl_ends&#39;,index:&#39;ttl_ends&#39;,align:&#39;center&#39;, width:200,fixed:true,</p>
<p>formatter:"date",</p>
<p>formatoptions:{srcformat:"Y-m-d H:i:s",newformat:"{{U:DatetimeFormat}}"},</p>
<p>unformat:unformat,},</p>
<p>{name:&#39;ttl_diff&#39;,index:&#39;ttl_diff&#39;,align:&#39;center&#39;, width:100,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;comments&#39;,index:&#39;comments&#39;,align:&#39;center&#39;, width:45,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;snatched&#39;,index:&#39;snatched&#39;,align:&#39;center&#39;, width:45,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;downloaded&#39;,index:&#39;downloaded&#39;,align:&#39;center&#39;, width:45,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;seeders&#39;,index:&#39;seeders&#39;,align:&#39;center&#39;, width:45,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;leechers&#39;,index:&#39;leechers&#39;,align:&#39;center&#39;, width:45,fixed:true,sorttype:"int",},</p>
<p>{name:&#39;TVS&#39;,index:&#39;TVS&#39;,align:&#39;center&#39;, width:45,fixed:true,}</p>
<p>],</p>
<p>ignoreCase:true,</p>
<p>width: ((window_width &#62; $.minimal_window_width) ? window_width-108 : $.minimal_window_width-108),</p>
<p>height: window_height-311,</p>
<p>shrinkToFit: true,</p>
<p>sortorder: &#39;desc&#39;,</p>
<p>rowNum:100,</p>
<p>rowList:[20,50,100,200,500,1000],</p>
<p>pager: &#39;#tab-content-torrents-pager&#39;,</p>
<p>viewrecords: true,</p>
<p>rownumbers: true,</p>
<p>caption:"JSON Example",</p>
<p>ExpandColClick: false,</p>
<p>loadError : function(xhr,st,err) {</p>
<p>$("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);</p>
<p>},</p>
<p>loadComplete: function(data) {</p>
<p>if($("#tab-content-torrents").jqGrid(&#39;getGridParam&#39;,&#39;datatype&#39;) === "json")</p>
<p>{</p>
<p>setTimeout(function(){</p>
<p>$("#tab-content-torrents").trigger("reloadGrid");</p>
<p>},1);</p>
<p>}</p>
<p>},</p>
</p>
<p>});</p>
<p>$("#tab-content-torrents").jqGrid(&#39;navGrid&#39;,&#39;#tab-content-torrents-pager&#39;,{edit:true,add:true,del:true,search:true,refresh:false},</p>
<p>{}, // edit options</p>
<p>{}, // add options</p>
<p>{}, //del options</p>
<p>{multipleSearch:true} // search options</p>
<p>);</p>
<p>$("#tab-content-torrents").jqGrid(&#39;filterToolbar&#39;,{searchOnEnter:false,groupOp:&#39;OR&#39;,defaultSearch: &#39;cn&#39;,});</p>
<p>$("#tab-content-torrents").jqGrid(&#39;navButtonAdd&#39;,"#tab-content-torrents-pager",{caption:"Toggle",title:"Toggle Search Toolbar", buttonicon :&#39;ui-icon-pin-s&#39;,</p>
<p>onClickButton:function(){</p>
<p>torrentGrid[0].toggleToolbar()</p>
<p>}</p>
<p>});</p>
<p>$("#tab-content-torrents").jqGrid(&#39;navButtonAdd&#39;,"#tab-content-torrents-pager",{caption:"Clear",title:"Clear Search",buttonicon :&#39;ui-icon-refresh&#39;,</p>
<p>onClickButton:function(){</p>
<p>torrentGrid[0].clearToolbar()</p>
<p>}</p>
<p>});</p>
</blockquote>
<p>and here is JSON return from server:</p>
<blockquote>
<p>{</p>
<p>"total":1,</p>
<p>"page":1,</p>
<p>"records":1,</p>
<p>"rows":[</p>
<p>{"id":"12",</p>
<p>"cell":["12","4","pokus4","Movies",null,"yes","1","Monty.Python&#39;s.Flying.Circus.Complete.Multisub.DVDRiP.DivX-HM","2009-03-27 17:58:40","4294967295","2010-10-31 05:06:49","-838:59:59","10","0","1","0","0","yes"]},</p>
<p>{"id":"33",</p>
<p>"cell":["33","3","pokus3","Movies",null,"yes","1","24.hodin.S03.COMPLETE.iNTERNAL.DVD.XviD.CZ-JarG","2010-01-21 13:39:28","4294967295",null,null,"15","0","1","0","0","yes"]},</p>
<p>{"id":"55",</p>
<p>"cell":["55","2","pokus 2","Movies",null,"yes","1","Buffy.premozitelka.upiru.1x12.DVD.DivX.CZ-sparhawk","2006-02-17 02:18:33","408793258",null,null,"17","0","1","0","0","no"]},</p>
<p>{"id":"5",</p>
<p>"cell":["5","1","Pokus 1 edit","Television",null,"yes","2","SG-Atlantis.201-210.DVD.XviD.EN","2006-08-20 17:16:06","3669432941","2010-11-21 11:33:22","-697:52:29","15","0","1","0","0","no"]},</p>
<p>{"id":"387",</p>
<p>"cell":["387","-1",null,"Covers",null,"no","4"," [REQ]The Prodigy-Live in Prague 28-10-2006-XviD-2006-mV4U","2007-07-14 10:07:58","366755329",null,null,"0","0","0","0","0","no"]}]</p>
<p>}</p>
</blockquote>
<p>try it in this conf, and then change</p>
<blockquote>
<p>function torrentReq(value, options, rowObject)</p>
<p>{</p>
<p>var requestName = (!rowObject[2]) ? rowObject[&#39;requestname&#39;] : rowObject[2];</p>
<p>var requestID = (!rowObject[1]) ? rowObject[&#39;request_id&#39;] : rowObject[1];</p>
<p>var reqLink = (requestName) ? &#39;&#60;br&#62;&#60;span id="request-link-&#39;+requestID+&#39;" class="ui-request-link"&#62;&#39;+requestName+&#39;&#60;/span&#62;&#39; : &#39;&#39;;</p>
<p>return &#39;&#60;span&#62;&#39;+value+&#39;&#60;/span&#62;&#39;+reqLink;</p>
<p>}</p>
</blockquote>
<p>to</p>
<blockquote>
<p>function torrentReq(value, options, rowObject)</p>
<p>{</p>
<p>var requestName = rowObject[2];</p>
<p>var requestID = rowObject[1];</p>
<p>var reqLink = (requestName) ? &#39;&#60;br&#62;&#60;span id="request-link-&#39;+requestID+&#39;" class="ui-request-link"&#62;&#39;+requestName+&#39;&#60;/span&#62;&#39; : &#39;&#39;;</p>
<p>return &#39;&#60;span&#62;&#39;+value+&#39;&#60;/span&#62;&#39;+reqLink;</p>
<p>}</p>
</blockquote>
<p>and comment loadcomplete option in grid</p>
]]></description>
        	        	<pubDate>Mon, 20 Dec 2010 14:29:17 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Formatter rowObject is not object</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21357</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21357</guid>
        	        	<description><![CDATA[<p>Sorry, but you posted too less information. You should include the definition of your jqGrid including the code of your custom formatter. Moreover the JSON data returned from the server are also needed. By the way in the most cases the rowObject <em>should be initially not a text, but array of texts instead</em>.</p>
<p>Look at close question <a href="http://stackoverflow.com/questions/4485970/jqgrid-rowobject-inconsistencies/4486142#4486142" target="_blank">here</a>. Probably it will help you.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Mon, 20 Dec 2010 14:13:58 +0200</pubDate>
        </item>
        <item>
        	<title>AndzinSan on Formatter rowObject is not object</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21355</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-rowobject-is-not-object#p21355</guid>
        	        	<description><![CDATA[<div>
<p>Hi,</p>
<p>I have grid with json datatype and loadonce:true parameter. When i use custom function formatter for some column, rowObject (formatter parameter) is not object, it is text, when grid is loaded first time. rowObject change to object only after i sort grid, using paginator or using this function:</p>
<blockquote>
<p>loadComplete: function(data) {</p>
<p>if($("#tab-content-torrents").jqGrid(&#39;getGridParam&#39;,&#39;datatype&#39;) === "json")</p>
<p>{ &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;</p>
<p>setTimeout(function(){</p>
<p>$("#tab-content-torrents").trigger("reloadGrid");</p>
<p>},1);</p>
<p>}</p>
<p>},</p>
</blockquote>
<p>This works but, on first load formatted text (using rowObject[index]) display text "undefined" and then change it to corect value (if i use loadcomplete function bellow).</p>
<p>The question is how to make rowObject as object in first load grid - without need to paginate, sort or reloadgrid??</p>
</div>
]]></description>
        	        	<pubDate>Mon, 20 Dec 2010 13:56:46 +0200</pubDate>
        </item>
</channel>
</rss>