<?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 link - specify target</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target</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-link-specify-target/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>casperd on formatter link - specify target</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target#p6829</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target#p6829</guid>
        	        	<description><![CDATA[<blockquote>
<p>Hi Adam,</p>
<p>I ahve copied your code into my jquery.fmatter.js file, and have included the formatoptions in my colmodel (using "_new" as my target), but the url still opens in the same window, and not a new one.</p>
<p>Any ideas?</p>
<p>Thanks!</p>
<p>---------------------------------------------------------------------------</p>
<p>&#160;&#160;&#160; $.fn.fmatter.link = function(el,cellval,opts) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; //begin url target mod : <a href="mailto:adam@PigsLipstick.com" target="_blank">adam@PigsLipstick.com</a><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var op = {target:opts.target };<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var target = &#8220;&#8221;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(!isUndefined(opts.colModel.formatoptions)) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; op = $.extend({},op,opts.colModel.formatoptions);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; target = &#39;target=&#39; + op.target;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; //end url target mod (note inclusion of target variable in url)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(!isEmpty(cellval)) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(el).html(&#8221;&#60;a &#8221; + target + &#8221; href=\\&#8221;" + cellval + &#8220;\\&#8221;&#62;&#8221; + cellval + &#8220;&#60;/a&#62;&#8221;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(el).html(isValue(cellval) ? cellval : &#8220;&#8221;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; };</p>
<p>and then the corresponding piece in the colModel to specify the formatoptions:</p>
<p><span class="sfcode">{name:&#39;link&#39;, index:&#39;link&#39;, width: 300, editable:true,editoptions:{size:45}, formatter:&#39;link&#39;,formatoptions:{target:&#8221;_new&#8221;}}</span></p>
<p>Best Regards,</p>
<p>Adam</p>
</blockquote>
<hr />
]]></description>
        	        	<pubDate>Thu, 21 May 2009 01:18:40 +0300</pubDate>
        </item>
        <item>
        	<title>tony on formatter link - specify target</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target#p5726</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target#p5726</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thank you Adam - good addition. Will be added.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 01 Apr 2009 03:04:33 +0300</pubDate>
        </item>
        <item>
        	<title>akremedy on formatter link - specify target</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target#p5706</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formatter-link-specify-target#p5706</guid>
        	        	<description><![CDATA[<p>Maybe this should go under feature request?&#160; I&#39;ll put it here in case it is helpful to somebody else someday.</p>
<p>I did this for jqGrid 3.5, but it should be the same for other versions.&#160; This is a small hack to jquery.fmatter.js to allow specification of a target when using links in a grid:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4017' value='Select Code' data-codeid='sfcode4017' /></p>
<div class='sfcode' id='sfcode4017'>&#160;&#160;&#160; $.fn.fmatter.link = function(el,cellval,opts) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; //begin url target mod : <a href="mailto:adam@PigsLipstick.com" target="_blank">adam@PigsLipstick.com</a><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var op = {target:opts.target };<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var target = "";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(!isUndefined(opts.colModel.formatoptions)) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; op = $.extend({},op,opts.colModel.formatoptions);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; target = &#39;target=&#39; + op.target;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; //end url target mod (note inclusion of target variable in url)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(!isEmpty(cellval)) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(el).html("&#60;a " + target + " href=\\"" + cellval + "\\"&#62;" + cellval + "&#60;/a&#62;");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(el).html(isValue(cellval) ? cellval : "");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; };</div>
<p>and then the corresponding piece in the colModel to specify the formatoptions:</p>
<p><span class="sfcode">{name:&#39;link&#39;, index:&#39;link&#39;, width: 300, editable:true,editoptions:{size:45}, formatter:&#39;link&#39;,formatoptions:{target:&#8221;_new&#8221;}}</span></p>
<p>Best Regards,</p>
<p>Adam</p>
]]></description>
        	        	<pubDate>Tue, 31 Mar 2009 15:35:01 +0300</pubDate>
        </item>
</channel>
</rss>