<?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: getAccessor</title>
	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor</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/discussion/getaccessor/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tnorup on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p19481</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p19481</guid>
        	        	<description><![CDATA[</p>
<p>Sorry to say, but problems still remain.</p>
<p>I have experienced a web page to work perfectly on Ubuntu/Firefox 3.6.8 while the same page fails on Windows/Firefox 3.6.8.</p>
<p>The problem was that the expr parameter in some cases is an integer (i.e. neither string nor function) (don&#39;t ask me why - I haven&#39;t been able to figure that out; it only happen in a single grid out of 6 in my application). In that case, the local variable prm becomes undefined and an exception is raised.</p>
<p>I have fixed it by initialising prm to the empty string like this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1515' value='Select Code' data-codeid='sfcode1515' /></p>
<div class='sfcode' id='sfcode1515'>
<p>...</p>
<p>if (ret === undefined) {</p>
<p>&#160;&#160;&#160;&#160;&#160; prm = &#39;&#39;</p>
<p>&#160;&#160;&#160;&#160;&#160; if(typeof expr === &#39;string&#39;) {</p>
<p>...</p>
</div>
<p>However, this fix might bee too simplistic - possibly there should be an explicitly coded reaction on typeof expr === &#39;integer&#39;.</p>
</p>
<p>The JSON data file causing the exception is this one, which - to me -seems flawless:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8765' value='Select Code' data-codeid='sfcode8765' /></p>
<div class='sfcode' id='sfcode8765'>
<p>{&#34;rows&#34;: [<br />{&#34;cell&#34;: [26, &#34;MS-S-728-0001&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;, &#34;Kirsten&#34;, &#34;2010-07-08&#34;, &#34;TILL&#34;, &#34;Finansministeriet&#34;, &#34;Finansministeriet&#34;, null, &#34;-&#34;], &#34;id&#34;: 26}, <br />{&#34;cell&#34;: [32, &#34;MS-M-728-0001&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;, &#34;PwSkrivDocTransmittal \u2013 edh&#34;, &#34;2010-08-30&#34;, &#34;S-ANS&#34;, &#34;Finansministeriet&#34;, &#34;Finansministeriet&#34;, 4, &#34;Start&#34;], &#34;id&#34;: 32}, <br />{&#34;cell&#34;: [33, &#34;MS-M-728-0003&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;, &#34;PwSkrivDocTransmittal \u2013 edh&#34;, &#34;2010-08-30&#34;, &#34;TILL&#34;, &#34;Kbh. Kommunes Milj\u00f8kontrol&#34;, &#34;Finansministeriet&#34;, 4, &#34;...0001&#34;], &#34;id&#34;: 33}, <br />{&#34;cell&#34;: [34, &#34;MS-M-728-0004&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;, &#34;placeholder 1 descr&#34;, &#34;2010-08-30&#34;, &#34;ANS&#34;, &#34;Finansministeriet&#34;, &#34;Finansministeriet&#34;, 4, &#34;Start&#34;], &#34;id&#34;: 34}, <br />{&#34;cell&#34;: [35, &#34;MS-M-728-0005&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#34;, &#34;Placeholder 2&#34;, &#34;2010-08-30&#34;, &#34;-&#34;, &#34;-&#34;, &#34;-&#34;, 4, &#34;-&#34;], &#34;id&#34;: 35}<br />], &#34;total&#34;: 22, &#34;page&#34;: 1, &#34;pages&#34;: 3}</p>
</div>
<p>BTW, thanks for a brilliant plug-in!</p>
<p>Theodor</p>
]]></description>
        	        	<pubDate>Thu, 02 Sep 2010 11:43:24 +0300</pubDate>
        </item>
        <item>
        	<title>tony on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p17678</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p17678</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thank you. This have sence. Fixed.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 02 Jun 2010 20:14:02 +0300</pubDate>
        </item>
        <item>
        	<title>zerikv on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p17614</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p17614</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I have a problem with getAccessor() in grid.base.js v3.6.5 line 464</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6744' value='Select Code' data-codeid='sfcode6744' /></p>
<div class='sfcode' id='sfcode6744'>
<p>&#160;&#160; &#160;&#160;&#160;&#160; getAccessor = function(obj, expr) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var ret,p,prm, i;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if( typeof expr === &#39;function&#39;) { return expr(obj); }<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = obj[expr];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(ret===undefined) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; if ( typeof expr === &#39;string&#39; ) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;prm = expr.split(&#39;.&#39;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;try {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;i = prm.length; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if( i ) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = obj;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; while (ret &#38;&#38; i--) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;p = prm.shift();<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = ret[p];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} catch (e) {}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return ret;<br />&#160;&#160; &#160;&#160;&#160; &#160;}</p>
</div>
<p>The line 464 is where variable "i" is affected with the length of variable "prm".</p>
<p>The variable "prm" is undefined when it&#39;s not a string.</p>
<p>To avoid this problem I have moved the try-catch bock inside the body of the &#160; if ( typeof expr === &#39;string&#39; ) {</p>
</p>
<p>Regards,</p></p>
]]></description>
        	        	<pubDate>Mon, 31 May 2010 19:10:31 +0300</pubDate>
        </item>
        <item>
        	<title>CTAPbIu_MABP on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14635</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14635</guid>
        	        	<description><![CDATA[<p>try-catch successfully supress error 😉</p>
]]></description>
        	        	<pubDate>Mon, 08 Feb 2010 17:14:42 +0200</pubDate>
        </item>
        <item>
        	<title>tony on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14634</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14634</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks. Could you please try with this</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6517' value='Select Code' data-codeid='sfcode6517' /></p>
<div class='sfcode' id='sfcode6517'>
<p>&#160;&#160; &#160;&#160;&#160;&#160; getAccessor = function(obj, expr) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var ret,p,prm;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = obj[expr];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(ret===undefined) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; if ( typeof expr === &#39;string&#39; ) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;prm = expr.split(&#39;.&#39;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(prm.length) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = obj;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; while (ret &#38;&#38; prm.length) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;p = prm.shift();<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = ret[p];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (e) {}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return ret;<br />&#160;&#160; &#160;&#160;&#160; &#160;},</p>
</div>
<p>Please let me known if everthing is ok.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 08 Feb 2010 17:09:05 +0200</pubDate>
        </item>
        <item>
        	<title>CTAPbIu_MABP on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14633</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14633</guid>
        	        	<description><![CDATA[<p>I have a problem with this new code</p>
<p>Sorry but my inglish is too poor to describe this isue properly</p>
</p>
<p>I have a mapping</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2692' value='Select Code' data-codeid='sfcode2692' /></p>
<div class='sfcode' id='sfcode2692'>{name:&#34;id&#34;, index:&#34;id&#34;, width:40, sorttype:&#34;string&#34;, editable:false},<br />{name:&#34;login&#34;, index:&#34;login&#34;, width:100, sorttype:&#34;string&#34;, editable: true},<br />{name:&#34;firstName&#34;, index:&#34;firstName&#34;, width:100, sorttype:&#34;string&#34;, editable:true},<br />{name:&#34;lastName&#34;, index:&#34;lastName&#34;, width:100, sorttype:&#34;string&#34;, editable:true},<br />{name:&#34;newPassword&#34;, index:&#34;newPassword&#34;, hidden:true, editable: true, edittype:&#34;password&#34;,editrules:{edithidden:true}},<br />{name:&#34;confirmPassword&#34;,index:&#34;confirmPassword&#34;, hidden:true, editable: true, edittype:&#34;password&#34;,editrules:{edithidden:true}}</div>
<p>It not really matters what columns I have. Look at last two of them. They are hidden and editable. The front-end dont need real passwords becouse they are encrypted and so on. So I dont send this fields</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9808' value='Select Code' data-codeid='sfcode9808' /></p>
<div class='sfcode' id='sfcode9808'>row : [{ id : 1, cell : [1,  &#34;CTAPbIu_MABP&#34;, &#34;First Name&#34;, &#34;Last Name&#34;]}]</div>
<p>before this changes (before you create getAccessor) this code works fine. and now it breaks with erroron line</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8858' value='Select Code' data-codeid='sfcode8858' /></p>
<div class='sfcode' id='sfcode8858'>if(prm.length)</div>
<p>becouse&#160; obj[expr] === undefined&#160; and prm is an integer and have no length</p>
</p>
<p>I dont think this is a bug but note that new code is incompatiable with old one</p></p>
]]></description>
        	        	<pubDate>Mon, 08 Feb 2010 16:34:43 +0200</pubDate>
        </item>
        <item>
        	<title>CTAPbIu_MABP on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14631</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14631</guid>
        	        	<description><![CDATA[<p>Nice to see new code)))</p>
]]></description>
        	        	<pubDate>Mon, 08 Feb 2010 14:42:51 +0200</pubDate>
        </item>
        <item>
        	<title>CTAPbIu_MABP on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14543</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14543</guid>
        	        	<description><![CDATA[<p>&#62;&#62; Did you try the script?</p>
</p>
<p>Yes and I dont see any errors yet 🙂</p>
]]></description>
        	        	<pubDate>Thu, 04 Feb 2010 13:00:13 +0200</pubDate>
        </item>
        <item>
        	<title>tony on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14528</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14528</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks.</p>
<p>Did you try the script?</p>
<p>Also I know that using eval is not safe.</p>
<p>I will see if we can done it better. Thank you for the link - it help me to understand another way of doing this and maybe we will change this behaviour.</p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 03 Feb 2010 20:14:24 +0200</pubDate>
        </item>
        <item>
        	<title>CTAPbIu_MABP on getAccessor</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14474</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/getaccessor#p14474</guid>
        	        	<description><![CDATA[<p>I noticed new function in github repository</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1684' value='Select Code' data-codeid='sfcode1684' /></p>
<div class='sfcode' id='sfcode1684'>&#160;&#160; &#160;&#160;&#160;&#160; getAccessor = function(obj, expr) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var ret;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = obj[expr];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(ret===undefined) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;try {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ret = eval(&#34;obj.&#34;+expr);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} catch (e) {}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return ret;<br />&#160;&#160; &#160;&#160;&#160; &#160;},</div>
</p>
<p>it seems to be a misstype. there is no "obj" in global space to deal with so it might be</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8537' value='Select Code' data-codeid='sfcode8537' /></p>
<div class='sfcode' id='sfcode8537'>eval(obj+&#34;.&#34;+expr);</div>
</p>
<p>And I think this is not very safe operation</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7489' value='Select Code' data-codeid='sfcode7489' /></p>
<div class='sfcode' id='sfcode7489'>eval(&#34;window&#34;+&#34;.&#34;+&#34;alert(1)&#34;);</div>
</p>
<p>may be you should use this plugin</p>
<p><a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://benalman.com/projects/jquery-getobject-plugin/&#39;);" rel="nofollow" href="http://benalman.com/projects/jquery-getobject-plugin/" target="_blank"></a><a href="http://benalman.com/projects/j" rel="nofollow" target="_blank">http://benalman.com/projects/j</a>.....ct-plugin/</p>
<p>to get</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit991' value='Select Code' data-codeid='sfcode991' /></p>
<div class='sfcode' id='sfcode991'>eval(obj+&#34;.&#34;+&#34;a.b.c&#34;);</div>
]]></description>
        	        	<pubDate>Mon, 01 Feb 2010 15:24:38 +0200</pubDate>
        </item>
</channel>
</rss>