<?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: How to do a conditional Cell Update</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update</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/how-to-do-a-conditional-cell-update/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Pete on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8824</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8824</guid>
        	        	<description><![CDATA[<p>Well, not finding any examples, I did it this way:</p>
</p>
<p>$(&#39;#subUT&#39;).jqGrid({<br />&#160;&#160; url: jsonURL,<br />&#160;&#160; editurl: editURL,<br />&#160; datatype: &#39;json&#39;,<br />&#160;&#160; height: 250,<br />&#160;&#160; colNames:[&#39;Day of the Week&#39;, &#39;Begin Time&#39;,&#39;Ending Time&#39;], <br />&#160; colModel:[<br />&#160;&#160; {name:&#39;dayOfWeek&#39;,index:&#39;dayOfWeek&#39;, width:150, editable:true},<br />&#160;&#160; {name:&#39;startTime&#39;,index:&#39;startTime&#39;, width:100, editable:true},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;endTime&#39;,index:&#39;endTime&#39;, width:100, editable:true}&#160; <br />&#160;&#160; ],&#160; <br />&#160; rowNum:10, <br />&#160; rowList:[10,20,30],<br />&#160; imgpath: gridimgpath,<br />&#160; sortname: &#39;dayOfWeek&#39;,<br />&#160;&#160;&#160;&#160; onSelectRow: function(id){<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; if(id &#38;&#38; (id != lastsel)){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var mySavedRow = $(&#39;#subUT&#39;).getGridParam(&#39;savedRow&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var rownumsaved = mySavedRow.length - 1;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(rownumsaved &#62;=0)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var rowData = mySavedRow[rownumsaved];<br />&#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(rowData)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; savedSubRowData = rowToString(rowData);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#subUT&#39;).saveRow(lastsel,saveRowCheck,editURL,{&#39;extras&#39;:savedSubRowData});<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#subUT&#39;).editRow(id,true,clockpick);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; lastsel=id;<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; },<br />&#160;&#160;&#160; formatCell:function(rowid,cellname,value,irow,icol){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; alert(&#39;Format!&#39;);<br />&#160;&#160;&#160; },<br />&#160;&#160;&#160; beforeEditCell:function(rowid,cellname,value,irow,icol){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; alert(&#39;Before Edit!&#39;);<br />&#160;&#160;&#160; },<br />&#160; sortorder: "desc", <br />&#160; jsonReader: {repeatitems: false},<br />&#160; caption: "Substitute Unavailable Times" <br />&#160; });</p>
<p>It may be the wrong way to implement it but that is what I did.&#160; <img class="spSmiley" style="margin:0" title="Confused" src="/blog/wp-content/forum-smileys/sf-confused.gif" alt="Confused" /></p>
]]></description>
        	        	<pubDate>Wed, 19 Aug 2009 17:59:31 +0300</pubDate>
        </item>
        <item>
        	<title>tony on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8777</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8777</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Where you call these event?</p>
<p>Also check: New in version 3.3 - &#62; Cell Editing</p>
</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 19 Aug 2009 05:14:45 +0300</pubDate>
        </item>
        <item>
        	<title>Pete on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8702</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8702</guid>
        	        	<description><![CDATA[<p>Can you give me a hint as to which example you are referring to?&#160; I looked at the Load Complete example but that is triggered by all the data being loaded from the server *I think*.</p>
<p>What I need is an example of where the *cell* has been edited (or something close to a row by row, cell by cell edit).&#160; If I add the following to my grid constructor:</p>
<p>&#160;&#160;&#160; formatCell:function(rowid,cellname,value,irow,icol){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; alert("Format!");<br />&#160;&#160;&#160; },&#160;&#160;&#160; <br />&#160;&#160;&#160; beforeEditCell:function(rowid,cellname,value,irow,icol){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; alert("Before Edit!");<br />&#160;&#160;&#160; },</p>
</p>
<p>But these even never seem to trigger.&#160; If I can find an event that is triggered by an individual cell being edited in an inline edit, I think I can hook up the logic I need</p>
]]></description>
        	        	<pubDate>Mon, 17 Aug 2009 09:09:55 +0300</pubDate>
        </item>
        <item>
        	<title>tony on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8624</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8624</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Check the demo. There is such example.</p>
<p>Regards</p>
<p>Tony</p>
</p>
<p>P.S. The first that I will do is to put alert before the if statement</p></p>
]]></description>
        	        	<pubDate>Sat, 15 Aug 2009 02:53:24 +0300</pubDate>
        </item>
        <item>
        	<title>Pete on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8582</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8582</guid>
        	        	<description><![CDATA[<p>Thanks.&#160; Bummer!&#160; The code snippet is part of the larger instantiation of the grid object itself.&#160; I think the code is correct but since afterSaveCell is never fired, I never had a chance to debug the code.&#160; I ran into several issues when I used the 3.5 version so I reverted back to 3.4.4&#160; Eventually I&#39;ll go to 3.5 but I have a deadline and don&#39;t want to spend time re-working code at this point.</p>
<p>So there is no way to capture an event that fires when the cell contents change in 3.4.4?&#160; I&#39;ll have to look into it more closely.&#160; Maybe I can modify the existing code to trigger an event when the data in the cell changes.</p></p>
]]></description>
        	        	<pubDate>Fri, 14 Aug 2009 09:30:42 +0300</pubDate>
        </item>
        <item>
        	<title>glemarie on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8573</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8573</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>If I remember, the two events I mentionned are only triggered when the field value is modified (I use jqGrid 3.5 and the events are correctly fired). And no, I don&#39;t see any other solution... sorry 🙁</p>
<p>Just a point : the code you mentionned is your real code ? If it is, it seems that you should call setCell from the grid object, like <em>$(&#39;#mygrid&#39;)</em>.setCell</p>
]]></description>
        	        	<pubDate>Fri, 14 Aug 2009 02:57:37 +0300</pubDate>
        </item>
        <item>
        	<title>Pete on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8556</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8556</guid>
        	        	<description><![CDATA[<p>Thanks for the wiki reference.&#160; I need to remind myself to look there.&#160;</p>
<p>That did not work.&#160; Let me give you a bit more information, perhaps I didn&#39;t explain enough of what I am doing.</p>
<p>I am using jqGrid 3.4.4 and I am using inline editing.&#160; As I change the contents of one cell (depending upon it&#39;s name) I want to change the contents of another cell.</p>
<p>I added the afterSaveCell like so:</p>
<p>&#160;&#160;&#160; afterSaveCell:function(id,cellName,data,iRow,iCol){<br />&#160;&#160;&#160; &#160;&#160;&#160; if(cellName==&#39;code&#39;)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; setCell(id,&#39;description&#39;,&#39;New Cell Description&#39;);<br />&#160;&#160;&#160; },</p>
</p>
<p>I can see the afterSaveCell event is triggered as the grid is created and populated, but if I then edit the contents of the cell and click into another cell, the afterSaveCell event isn&#39;t triggered.&#160; Really, what I want is an &#39;onCellChange&#39; event that triggered whenever the cell contents change.</p>
<p>Thanks for your help.&#160; Can you see any other way to do this?</p>
]]></description>
        	        	<pubDate>Thu, 13 Aug 2009 10:58:15 +0300</pubDate>
        </item>
        <item>
        	<title>glemarie on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8522</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8522</guid>
        	        	<description><![CDATA[<p>I used <span class="search_hit">afterSaveCell : </span>afterEditCell is triggered before any modification. You could also use beforeSaveCell.</p>
<p>The <a href="/jqgridwiki/doku.php?id=wiki:cell_editing&#38;s[]=aftersavecell" target="_blank">wiki contains the order in which events are triggered</a></p>
]]></description>
        	        	<pubDate>Thu, 13 Aug 2009 02:46:55 +0300</pubDate>
        </item>
        <item>
        	<title>Pete on How to do a conditional Cell Update</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8482</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-do-a-conditional-cell-update#p8482</guid>
        	        	<description><![CDATA[<p>I have cells that are related in a row.&#160; If one cell changes, then a different cell in the row should be updated.&#160; What event should I use to capture the change to the first cell in the row so that I can update the second?&#160; In some cases I just want to update the data in the other cell.&#160; In other cases I may want to change the edit options (change the list of select values).</p>
<p>Psuedo code would be something like:</p>
<p>On cellValueChange(cell)</p>
<p>&#160;&#160;&#160;&#160; update cell # 2 contents</p>
</p>
<p>I took a look at afterEditCell but it doesn&#39;t seem to trigger when the cell contents changes.&#160; What event should I look at?</p>
</p>
<p>Thanks</p>
]]></description>
        	        	<pubDate>Wed, 12 Aug 2009 17:57:32 +0300</pubDate>
        </item>
</channel>
</rss>