<?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: custom formatter in treegrid</title>
	<link>http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid</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/treegrid/custom-formatter-in-treegrid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>stefan.livens on custom formatter in treegrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6445</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6445</guid>
        	        	<description><![CDATA[<p>sorry i took some time to answer, i had to deliver the application.</p>
<p>In the end we decided to remove the treegrid from this applicatoin, due to performance issues: i have a tree with 2 root elements and each one has about 400-500 children. it loads quickly, but closing the folder (to hide the children) it took about 8 sec&#39;s!</p>
<p>Anyhow, back to the original problem:</p>
<p>I&#39;ve tried it like this:</p>
<p><code>colNames:[&#39;level&#39;,&#39;Id&#39;,&#39;Name&#39;,&#39;Description&#39;,&#39;info&#39;],<br />&#160;&#160;&#160; &#160;&#160;&#160; colModel:[<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;level&#39;,index:&#39;level&#39;, width:40,jsonmap:"level"}, <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;id&#39;,index:&#39;id&#39;, width:40, hidden:true}, <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;name&#39;,index:&#39;name&#39;, width:150},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;description&#39;,index:&#39;description&#39;, width:150},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;info&#39;,index:&#39;info&#39;, width:40,formatter:abk_testFormat,resizable:false,search:false,sortable:false,jsonmap:"name"}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ],</code></p>
</p>
<p>And this in my formatter:</p>
<p><code>abk_testFormat = function(el, cellval, opts){//used to display the &#39;info&#39; link<br />&#160; <br />&#160;&#160;&#160; console.log("opts3:",opts.rowData);<br />&#160;&#160;&#160; console.log("opts4:",opts.rowData.level);<br /></code></p>
<p>Still, opts4 always return "undefined".</p>
<p>I didn&#39;t want to go for the first solution (use "afterInsertRow") because of the amount of rows I could have. But I&#39;ll try that, and let you know if it works.</p>
</p>
<p>Stefan</p>
]]></description>
        	        	<pubDate>Mon, 04 May 2009 11:52:06 +0300</pubDate>
        </item>
        <item>
        	<title>tony on custom formatter in treegrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6389</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6389</guid>
        	        	<description><![CDATA[<p>Hello Stefan,</p>
<p>This is what I mean.</p>
<p>"I&#39;m not sure I understand &#8220;named conventions&#8221;, "</p>
<p>sorry I mean data is provided as name:value i.e. the way that you do.</p>
<p>Please let me known if the option 2 work.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 29 Apr 2009 15:26:58 +0300</pubDate>
        </item>
        <item>
        	<title>stefan.livens on custom formatter in treegrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6371</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6371</guid>
        	        	<description><![CDATA[<p>ah, I see.</p>
<p>I&#39;m using JSON, and my data is like this:</p>
<p><code>{"total":"1","rows":[{"level":"0","isLeaf":"false","expanded":"false","description":" group description" ,"name":"groupname01","parent":"null","id":"groupname01"},{"level":"1","isLeaf":"true","expanded":"true" ,"name":"name02","parent":"groupname01","id":"name02"} ....</code></p>
<p>So the level is sent first.</p>
<p>I don&#39;t have "info" in my JSON, this is an extra column in the view, that I map to the name (with jsonmap:"name") because i need that to construct the url.</p>
<p>So I think i have everything for option 2, or do i need to do something else? I&#39;m not sure I understand "named conventions", do you mean i need to explicitly define in my jsonReader to use "level"?</p>
<p>Thanks already,</p>
<p>Stefan</p>
]]></description>
        	        	<pubDate>Wed, 29 Apr 2009 05:39:03 +0300</pubDate>
        </item>
        <item>
        	<title>tony on custom formatter in treegrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6359</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6359</guid>
        	        	<description><![CDATA[<p>Hello Stefan,</p>
<p>Nothing wrong here.</p>
<p>The limitation is that the level field is not accesable during this operations. To explain better. Level field is the last field (if I remember right) and is provided as last in the data.</p>
<p>Example if you have field1, field2, field3,..</p>
<p>then if you format the data of field2 you have acces to field1 and field2, but not to field3, since this field is not yet fetched from the grid.</p>
<p>To resolve the problem</p>
<p>1. You can use afterInsertRow event to add a link, where all the row info is available<code><br /></code></p>
<p>2. We can use some tricky way to do this, but my question is in wich format is your data - xml or json? The idea is to use named conventions in the data, wehre you provide the level element before the info element.</p>
<p>Hope this helps</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 28 Apr 2009 09:42:31 +0300</pubDate>
        </item>
        <item>
        	<title>stefan.livens on custom formatter in treegrid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6335</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/custom-formatter-in-treegrid#p6335</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I have a problme with the treegrid that really baffles me.</p>
<p>Some context:</p>
<p>I have a grid with a custom formatter, and a switch to change this grid to a treegrid (with a .GridUnload method)</p>
<p>this is some code:</p>
<p><code>colModel:[ ....<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;info&#39;,index:&#39;info&#39;, width:40,formatter:abk_testFormat,resizable:false,search:false,sortable:false,jsonmap:"name"}<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ],</code></p>
<p>and my abk_testFormat:</p>
<p><code>abk_testFormat = function(el, cellval, opts){//used to display the &#39;info&#39; link<br />&#160;&#160;&#160; console.log("test1",opts);<br />&#160;&#160;&#160; console.log("test2",opts.rowData.id);<br />&#160;&#160;&#160; console.log("test3",opts.rowData.level);<br />...other stuff</code></p>
<p>What I try is to get the "level" from the row in the grid.</p>
<p>In the above example test1 and test2 give me correct results, but test3 always returns undefined. when i click in firebug on the result of test1, i get a DOM view, and there i can see the level element. But it doesn&#39;t work in the js.</p>
<p>Any idea?</p>
<p>Or another way to look at this problem? (basicly: i need to display a link to an info page only for the children, not for the root elements)</p>
<p>Thanks in advance,</p>
</p>
<p>Stefan</p></p>
]]></description>
        	        	<pubDate>Mon, 27 Apr 2009 12:16:07 +0300</pubDate>
        </item>
</channel>
</rss>