<?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: Clicking on image in cell not working</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/clicking-on-image-in-cell-not-working</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/clicking-on-image-in-cell-not-working/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>jqwha on Clicking on image in cell not working</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/clicking-on-image-in-cell-not-working#p18716</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/clicking-on-image-in-cell-not-working#p18716</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I have a "custom" cell which contains a text box and an image - the user will click on the image, which runs some javascript and populates the text box. The problem is that clicking the image doesn&#39;t run the script but instead triggers the onSelectRow event for the grid.</p>
<p>Code is below - hope someone can help?</p>
<p>Thanks.</p>
</p>
<p>&#160;&#160;&#160; jQuery(document).ready(function() {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; og = jQuery("#jqGrid1").jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: "local",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name: &#39;RowID&#39;, label: &#39;Row ID&#39;, index: &#39;RowID&#39;, width: 10, hidden: true, editable: false, sortable: true, sorttype: "int" },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name: &#39;System&#39;, label: &#39;System&#39;, index: &#39;System&#39;, width: 160, editable: false, sortable: true, sorttype: "text" },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name: &#39;AccessDate&#39;, label: &#39;Access Date&#39;, index: &#39;AccessDate&#39;, width: 140, editable: true, edittype: "custom", editoptions: { custom_element: AccessDateDatePicker, custom_value: AccessDateDatePickerValue }, sortable: false }<br />&#160;&#160;&#160;&#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; pager: &#39;#pager1&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 10,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList: [10, 20, 500],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; localReader: { id: "RowID" },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; loadonce: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; autowidth: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cellsubmit: &#39;clientArray&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl: &#39;clientArray&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;System&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: &#39;asc&#39;,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; onSelectRow: function(id,tmp) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (id &#38;&#38; id != lastgridsel) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(&#39;#jqGrid1&#39;).saveRow(lastgridsel, false, &#39;clientArray&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(&#39;#jqGrid1&#39;).editRow(id, true, null, null, &#39;clientArray&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastgridsel = id;<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;&#160;&#160;&#160; else if (id == lastgridsel) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(&#39;#jqGrid1&#39;).saveRow(lastgridsel, false, &#39;clientArray&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastgridsel = null;<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; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });<br />&#160;&#160;&#160; });</p>
<p>function AccessDateDatePicker(value, options) {<br />&#160;&#160;&#160; var dv = document.createElement("div");<br />&#160;&#160;&#160; var elDateTextBox = document.createElement("input");<br />&#160;&#160;&#160; elDateTextBox.id = options.id + "_txtDatePicker";<br />&#160;&#160;&#160; elDateTextBox.type = "text";<br />&#160;&#160;&#160; elDateTextBox.value = value;<br />&#160;&#160;&#160; elDateTextBox.style.width = "80px";<br />&#160;&#160;&#160; dv.appendChild(elDateTextBox);</p>
<p>&#160;&#160;&#160; var elImageButtonURL = document.createElement("a");<br />&#160;&#160;&#160; elImageButtonURL.href = "javascript:doSomething(&#39;" + elDateTextBox.id + "&#39;,&#39;&#39;, &#39;&#39;, &#39;" + value + "&#39;); event.cancelBubble = true;";</p>
<p>&#160;&#160;&#160; var elImageButton = document.createElement("img");<br />&#160;&#160;&#160; elImageButton.id = options.id + "imgDatePicker";<br />&#160;&#160;&#160; elImageButton.src = "../images/calendar.gif";<br />&#160;&#160;&#160; elImageButton.style.border = "0";<br />&#160;&#160;&#160; elImageButton.className = "classDatePickerButton";<br />&#160;&#160;&#160; elImageButtonURL.appendChild(elImageButton);</p>
<p>&#160;&#160;&#160; dv.appendChild(elImageButtonURL);<br />&#160;&#160;&#160; return dv;<br />}</p>
<p>function AccessDateDatePickerValue(elem) {<br />&#160;&#160;&#160; return $(elem).children(":first").val();<br />}</p>
]]></description>
        	        	<pubDate>Wed, 21 Jul 2010 17:02:34 +0300</pubDate>
        </item>
</channel>
</rss>