<?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: Validating a cell on change</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change</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/validating-a-cell-on-change/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Validating a cell on change</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p874</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p874</guid>
        	        	<description><![CDATA[<p>Reg,</p>
<p>For noneditable fields you should use a setRowData method</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 24 Jun 2008 02:19:12 +0300</pubDate>
        </item>
        <item>
        	<title>Reg on Validating a cell on change</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p873</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p873</guid>
        	        	<description><![CDATA[<p>Thank you Tony,</p>
<p>With your tip I have managed to get this going -- I guess the hard way, because I am using&#160;a getJSON call that seems to do all that I want it to. I&#39;m not ignoring your advice, I tried to make it work using the .change approach, but it kept firing when I created the new row and I wasn&#39;t able to see far enough ahead to be confident I could do different things for different fields. Not only am I learning jqGrid, but I really know&#160;almost nothing about jQuery and even javascript -- that&#39;s why your package is such a life-saver. I am learning, however.</p>
<p>Anyway, that part works and I greatly appreciate your help and patience on this. I am now getting json data back and am starting to work with that.</p>
<p>My problem is that I can insert this data into some of the fields on the selected row but not others -- my code (when the call is successful) includes the following:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39; + id + &#39;_invoiced&#39;).html(json.amount); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39; + id + &#39;_outstanding&#39;).html(json.outstanding); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39; + id + &#39;_project&#39;).val(json.project); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39; + id + &#39;_client&#39;).val(json.client);</p>
<p>Project and Client are modified correctly but Invoiced and Outstanding are not. One difference is that Project and Client are editable fields, and Invoiced and Outstanding are not. I tried using .val() on those two as well, but that also did not work. Are we able to modify uneditable fields like this -- or what am I doing wrong? Or is it that they are modified correctly but just not displaying?</p>
<p>Thanks</p>
<p>Reg</p>
]]></description>
        	        	<pubDate>Mon, 23 Jun 2008 20:40:36 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Validating a cell on change</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p850</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p850</guid>
        	        	<description><![CDATA[<p>Reg,</p>
<p>The problem in your last post is that you do not pass a parameter to bind</p>
<p>event. For more information refer to jQuery docs on how to set parameter</p>
<p>to bind function. I think there is a more simple solution to you problem.</p>
<p>$("mygrid").jqGrid({</p>
<p>...</p>
<p>onSelectRow: function(id){<br />&#160; $(&#39;#tblcontents_details&#39;).editRow(id,true,jqChecktblcontents_details);</p>
<p>},</p>
<p>...</p>
<p>});</p>
<p>var&#160;jqChecktblcontents_details = function(id){</p>
<p>$(&#39;#&#39;+id+&#8221;_&#8221;+&#8221;mycell&#8221;,&#8221;#mygrid&#8221;).change(function() {</p>
<p>// do something here</p>
<p>});</p>
<p>}</p>
</p>
<p>I think that this should work</p>
<p>Regards</p>
<p>Tony</p></p>
]]></description>
        	        	<pubDate>Sun, 22 Jun 2008 02:54:26 +0300</pubDate>
        </item>
        <item>
        	<title>Reg on Validating a cell on change</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p845</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p845</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>Yes, that was in your original post and somewhere along the way I forgot it; sorry to bother you with that bit of trivia.</p>
<p>I now have this function working ... almost. I made a&#160; change to use .bind, as shown here:</p>
<p>&#160;&#160;&#160;&#160;&#160; onSelectRow: function(id){<br />&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39;+id+&#39;_&#39;+&#39;invoice&#39;).bind(&#39;change&#39;,jqOnChangeinvoice);<br />&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#&#39;+id+&#39;_&#39;+&#39;amount&#39;).bind(&#39;change&#39;,jqOnChangeamount);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#tblcontents_details&#39;).editRow(id,true); },</p>
<p>This now fires only when the field contents change; when it does fire an object is passed to the listener (e.g., jqOnChangeInvoice -- shown here, still very much in test mode):</p>
<p>function jqOnChangeinvoice(id)<br />&#160; {<br />&#160;&#160;&#160; alert(&#39;id =&#39; + id); <br />&#160;&#160;&#160; $.ajax({url: "wc.dll?PSProcess~GetInvData&#38;amp;sk=2EC0GGNI01900&#38;amp;sh=75", type: &#39;GET&#39;, data: {invoice: &#39;15&#39; }, datatype: &#39;xml&#39;, success: alert("Data Loaded" + data) } );<br />&#160; };</p>
<p>When this fires, the alert shows "id = object Object"</p>
<p>Is this what you would expect?</p>
<p>If this object the cell&#160;or the row?</p>
<p>How can I&#160;get or set&#160;values from/to other cells on the same row in this function call?</p>
<p>Thanks</p>
<p>Reg</p>
]]></description>
        	        	<pubDate>Fri, 20 Jun 2008 10:58:39 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Validating a cell on change</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p839</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p839</guid>
        	        	<description><![CDATA[<p>Reg,</p>
<p>When you use a inlineedit and when the row is in edit mode the plugin creates anuquie id for that cell which is a combibantion of rowid+_+ the name of the cell. I think that this a simple. Suppose the name of cell is mycell</p>
<p>var&#160;jqChecktblcontents_details = function(id){</p>
<p>$(&#39;#&#39;+id+"_"+"mycell","#mygridid").change(function() {</p>
<p>// do something here</p>
<p>});</p>
<p>}</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 20 Jun 2008 03:41:23 +0300</pubDate>
        </item>
        <item>
        	<title>Reg on Validating a cell on change</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p834</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/validating-a-cell-on-change#p834</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
<p>In some other thread you described how to save a individual cell; I am trying to adapt that to my purposes and not having much success with it.</p>
<p>I am building an accounting application; I am using inline editing&#160;to provide for entering payments against invoices. When a row is selected, the operator enters an Invoice number, and when the focus leaves that cell (with tab, not enter), I want to use ajax to retrieve data about that invoice (date issued, to whom issued, original amount, total outstanding, etc.).</p>
<p>The name of the grid is <em>tblcontents_details</em>; the field is <em>invoice</em></p>
<p>So I have the following in the definition of the grid (all on one line, it wraps here):</p>
<p>&#160;&#160;&#160;&#160;&#160; onSelectRow: function(id){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#tblcontents_details&#39;).editRow(id,true,jqChecktblcontents_details); },</p>
<p>My function is this:</p>
<p>function jqChecktblcontents_details(id)<br />&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#tblcontents_details_invoice&#39;).change ($.ajax({url: "wc.dll?PSProcess~GetInvData&#38;amp;sk=2EB10HG8P3176&#38;amp;sh=7", type: &#39;GET&#39;, data: {invoice: &#39;15&#39; }, datatype: &#39;xml&#39;, success: alert("Data Loaded") } ));<br />&#160; };</p>
<p>My problem is that when I select the row to edit it, this function fires immediately (presumably because the value of the field changes from null to blank (or something like that) but never again. I can cope with it firing once at the start when I don&#39;t need it to, but what I really want is to have it fire when I leave the field after making a change</p>
</p>
<p>I have also tried to set the change function before editing like the following:</p>
<p>&#160;&#160;&#160;&#160;&#160; onSelectRow: function(id){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#tblcontents_details_invoice&#39;).change ($.ajax({url: "wc.dll?PSProcess~GetInvData&#38;amp;sk=2EB10HG8P3176&#38;amp;sh=17", type: &#39;GET&#39;, data: {invoice: &#39;15&#39; }, datatype: &#39;xml&#39;, success: alert("Data Loaded") } ));<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#tblcontents_details&#39;).editRow(id,true); },</p>
<p>The same thing happens; it fires as soon as I select the row, but not when the contents change.</p>
<p>Is there any way to maket his work? I hope I am missing something really simple.</p>
<p>Thanks</p>
<p>Reg</p>
]]></description>
        	        	<pubDate>Thu, 19 Jun 2008 18:22:43 +0300</pubDate>
        </item>
</channel>
</rss>