<?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: Adding different action icons to a column generated from XML subelements</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements</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/adding-different-action-icons-to-a-column-generated-from-xml-subelements/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>thepenguinwhisperer on Adding different action icons to a column generated from XML subelements</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements#p28841</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements#p28841</guid>
        	        	<description><![CDATA[<p>Note that the elements in actions should be script, name and image(I used the same name 2 times).</p>
<p>I fixed it in the following way (with a formatter on the actions column; I hope it helps someone else):</p>
</p>
<table class="file-code file-diff  line-number-attrs hide-line-numbers" border="0">
<tbody>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P23" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;function&#160;formatActions(cellValue,&#160;options,&#160;rowObject)&#160;{</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P24" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;actions&#160;=&#160;$(rowObject).find("actions");</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P25" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;var&#160;output&#160;=&#160;"";</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P26" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;$(&#39;action&#39;,&#160;actions).each(</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P27" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;function(i)&#160;{</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P28" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;actionName&#160;=&#160;$(this).find("name").text();</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P29" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;image&#160;=&#160;$(this).find("image").text();</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P30" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;script&#160;=&#160;$(this).find("script").text();</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P31" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P32" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;output&#160;+=&#160;"&#60;img&#160;src=""&#160;+&#160;image&#160;+&#160;""&#160;title=""&#160;+&#160;actionName&#160;+&#160;""&#160;onclick="javascript:"&#160;+&#160;script&#160;+&#160;""/&#62;";</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P33" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;&#160;&#160;}</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P34" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;);</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P35" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P36" class="file-diff-line gi">
<td class="diff-line-code">+&#160;&#160;&#160;&#160;return&#160;output;</td>
</tr>
<tr id="html-themes-redround-tmpl-inc-transferlist-tmpl-P37" class="file-diff-line gi">
<td class="diff-line-code">
<p>+&#160;&#160;}</p>
</td>
</tr>
</tbody>
</table>
]]></description>
        	        	<pubDate>Tue, 21 May 2013 12:10:50 +0300</pubDate>
        </item>
        <item>
        	<title>thepenguinwhisperer on Adding different action icons to a column generated from XML subelements</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements#p28839</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements#p28839</guid>
        	        	<description><![CDATA[<p>I&#39;m currently trying something like this (with a formatter on the actions xml mapping):</p>
</p>
<blockquote>
<p>function formatActions(cellValue, options, rowObject) {<br />&#160;&#160; &#160;&#160;&#160; &#160;actions = $(&#39;actions&#39;, rowObject);<br />&#160;&#160; &#160;&#160;&#160; &#160;output = "";<br />&#160;&#160; &#160;&#160;&#160; &#160;$(&#39;action&#39;, actions).each(<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;function(i) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;actionName = $(this).find("action_name").text();<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;image = $(this).find("image").text();<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;script = $(this).find("script").text();<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;output += actionName + " ";<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;);<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;return output;<br />&#160;&#160; &#160;}</p>
</blockquote>
<p>However this fails. I don&#39;t get into the function(i).</p>
<p>When I step through the code I actually get on the function(i) line, however no code inside it is executed.</p>
<p>It then goes just to the return line.</p>
]]></description>
        	        	<pubDate>Tue, 21 May 2013 02:16:10 +0300</pubDate>
        </item>
        <item>
        	<title>thepenguinwhisperer on Adding different action icons to a column generated from XML subelements</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements#p28838</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/adding-different-action-icons-to-a-column-generated-from-xml-subelements#p28838</guid>
        	        	<description><![CDATA[<p>Hi all,</p>
</p>
<p>I&#39;m currently trying to fill a column with different icons that each have javascript code to execute when they get clicked.</p>
<p>Coding the part to show the other columns was easy.</p>
<p>However for these actions the xml is formed as follows(note that the parts with tmpl are actually parsed on the server side to fill in the xml; this just shows the structure; there can be different actions for different transfers):</p>
<blockquote>
<p>&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;<br />&#60;transferslisting&#62;<br />&#160;&#160; &#160;&#60;page&#62;&#60;tmpl_var name="transferlist_page"&#62;&#60;/page&#62;<br />&#160;&#160; &#160;&#60;total&#62;&#60;tmpl_var name="transferlist_total_pages"&#62;&#60;/total&#62;<br />&#160;&#160; &#160;&#60;records&#62;&#60;tmpl_var name="transferlist_count"&#62;&#60;/records&#62;<br />&#160;&#160; &#160;&#60;transfers&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;tmpl_loop name="transferlist_torrents"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;transfer id=&#39;&#60;tmpl_var name="url_entry"&#62;&#39;&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;details&#62;&#60;![CDATA[ &#60;tmpl_var name="details_action"&#62; ]]&#62;&#60;/details&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;path&#62;&#60;![CDATA[ &#60;tmpl_var name="url_path"&#62; ]]&#62;&#60;/path&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;name&#62;&#60;![CDATA[ &#60;tmpl_var name="displayname"&#62; ]]&#62;&#60;/name&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;uprate&#62;&#60;tmpl_var name="up_speed"&#62;&#60;/uprate&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;downrate&#62;&#60;tmpl_var name="down_speed"&#62;&#60;/downrate&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;owner&#62; &#60;tmpl_if name="is_owner"&#62; &#60;![CDATA[ images/checked.png ]]&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;tmpl_else&#62; &#60;![CDATA[ images/edit.png ]]&#62;&#60;/tmpl_if&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;/owner&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;percentage&#62;&#60;tmpl_var name="percentage"&#62;&#60;/percentage&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;status&#62;&#60;![CDATA[ &#60;tmpl_var name="statusStr"&#62; ]]&#62;&#60;/status&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;size&#62;&#60;tmpl_var name="format_af_size"&#62;&#60;/size&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;eta&#62;&#60;![CDATA[ &#60;tmpl_var name="esttime"&#62; ]]&#62;&#60;/eta&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;actions&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;tmpl_loop name="transfer_actions"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;action&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;script&#62;&#60;![CDATA[&#60;tmpl_var name="action_name"&#62;]]&#62;&#60;/script&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;script&#62;&#60;![CDATA[&#60;tmpl_var name="image"&#62;]]&#62;&#60;/script&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;image&#62;&#60;![CDATA[&#60;tmpl_var name="script"&#62;]]&#62;&#60;/image&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;/action&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;/tmpl_loop&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;/actions&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;/transfer&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;/tmpl_loop&#62;<br />&#160;&#160; &#160;&#60;/transfers&#62;<br />&#60;/transferslisting&#62;</p>
</blockquote>
<p>The important element is "action". So in the last column I want that for each action in the actions element, some html code is generated with a clickable image. I would expect that I have to use a formatter on the "actions" element. Or does it has to be on the "action" element? Furthermore, how do I loop through them? Do I just pick the cellValue that is passed to the formatter and start parsing (with some xml parsing code or just some fiddling around with strings)?</p>
<p>I have to admit that I don&#39;t have experience with parsing xml.</p>
</p>
<p>Any help is greatly appreciated!</p>
]]></description>
        	        	<pubDate>Tue, 21 May 2013 01:09:27 +0300</pubDate>
        </item>
</channel>
</rss>