<?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: Custom validation with "actions" formatter edits</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/custom-validation-with-actions-formatter-edits</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/custom-validation-with-actions-formatter-edits/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>nisrak on Custom validation with "actions" formatter edits</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/custom-validation-with-actions-formatter-edits#p27049</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/custom-validation-with-actions-formatter-edits#p27049</guid>
        	        	<description><![CDATA[<p>Anyone have any idea how to do this please?</p>
<p>- Nisrak</p>
]]></description>
        	        	<pubDate>Thu, 02 Aug 2012 01:32:16 +0300</pubDate>
        </item>
        <item>
        	<title>nisrak on Custom validation with "actions" formatter edits</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/custom-validation-with-actions-formatter-edits#p27013</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/custom-validation-with-actions-formatter-edits#p27013</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I am using the JqGrid plugin for Grails (version 3.8.0.1).&#160; I have set up a jqGrid working with the predefined "actions" formatter for delete and edit and everything is working great!&#160; I am now trying to get some custom validation rules in place and have run into some problems.&#160; I defined a method that compares two values and set it as a constraint in the Domain class.&#160; Here is a sample of this definition:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5064' value='Select Code' data-codeid='sfcode5064' /></p>
<div class='sfcode' id='sfcode5064'>class VirtualResource {</p>
<p>&#160;&#160;&#160; def assetService</p>
<p>&#160;&#160;&#160; Asset asset<br />&#160;&#160;&#160; Float resourceCapacity = 0.0f</p>
<p>&#160;&#160;&#160; static belongsTo = [ asset : Asset ]</p>
<p>&#160;&#160;&#160; static constraints = {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; resourceCapacity( validator:{ cap, item -&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; item.assetService.checkCapacityAllocation(item.asset, cap, item, &#34;add&#34;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; })<br />&#160;&#160;&#160; }</p>
</div>
<p>This constraint works fine with add (which I am doing via a custom button).&#160; When I use the inline edit with the actions formatter, however, it accepts the input, displays no errors to the user, and gives the console error:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2249' value='Select Code' data-codeid='sfcode2249' /></p>
<div class='sfcode' id='sfcode2249'>Field error in object &#39;edu.hawaii.sitar.inf.VirtualResource&#39; on field &#39;resourceCapacity&#39;: rejected...</div>
</p>
<p>I have tried using every formatOption I could think of (onError, etc.) but none seem to work!&#160; I also tried using custom error notification but I cant figure out how to manipulate the actions formatter (again, formatOptions don&#39;t seem to be working).&#160; If this is an issue with the version I am using (3.8.0.1), is there a way to get a newer version working with Grails?</p>
<p>Any help would be greatly appreciated!&#160; Below is some of the code I am using for the jqgrid:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8324' value='Select Code' data-codeid='sfcode8324' /></p>
<div class='sfcode' id='sfcode8324'>$(document).ready(function() {</p>
<p>&#160;&#160;&#160; $(&#34;#btnAddVResource&#34;).click(function(){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#vResource_list&#34;).jqGrid(&#34;editGridRow&#34;,&#34;new&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {addCaption:&#39;Create New Virtual Resource&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; width:500, height:200,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; closeAfterAdd: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; params:{asset:${assetInstance.id}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; savekey:[true,13]});<br />&#160;&#160;&#160; });</p>
<p>&#160;&#160;&#160; jQuery(&#34;#vResource_list&#34;).jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; height:&#39;240&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; width:&#39;1200&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption:&#39;Capacity List&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; showPager:&#39;true&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; url:listVResourceUrl,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl:&#39;asset/editVResource?assetId=${assetInstance.id}&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#34;json&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames:[&#39;&#39;, &#39;Resource Type&#39;, &#39;Amount Allocated&#39;, &#39;Unit Type&#39;, &#39;id&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel:[<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;actions&#39;, index:&#39;actions&#39;, editable:false, required:false, sortable:false, width:&#34;20&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; formatter: &#39;actions&#39;, hidden:!editOption, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; formatoptions: {},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;resourceType&#39;, width:35, editable:true, edittype:&#39;select&#39;, editoptions: {value:<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#39;CPU&#39;:&#39;CPU&#39;, &#39;Memory&#39;:&#39;Memory&#39;, &#39;Disk&#39;:&#39;Disk&#39;}}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;resourceCapacity&#39;, width:50, editable:true, editrules: {number:true}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;unitType&#39;, width:30, editable:true, edittype:&#39;select&#39;, editoptions: {value:<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#39;Threads&#39;:&#39;Threads&#39;, &#39;Gigabytes&#39;:&#39;Gigabytes&#39;, &#39;Terabtyes&#39;:&#39;Terabytes&#39;}}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;id&#39;, hidden:true}<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],</p>
<p>&#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:[1,2,3,4,5,6,7,8,9,10],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: jQuery(&#39;#capacity_list_pager&#39;),<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; gridview: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cellsubmit: &#39;remote&#39;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; })<br />&#160;&#160;&#160; });</p>
</div>
]]></description>
        	        	<pubDate>Wed, 25 Jul 2012 02:02:51 +0300</pubDate>
        </item>
</channel>
</rss>