<?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: Problems with form editing, editurl and server-side method</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/problems-with-form-editing-editurl-and-server-side-method</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/problems-with-form-editing-editurl-and-server-side-method/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>asimu on Problems with form editing, editurl and server-side method</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problems-with-form-editing-editurl-and-server-side-method#p13110</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problems-with-form-editing-editurl-and-server-side-method#p13110</guid>
        	        	<description><![CDATA[<p>My mistake. As a quick test I was using &#160;the same grails method in both&#160;url and editurl. Doh.</p>
<p>The set of params given to the url server method are clearly different to the params given to the server method</p>
<p>for editurl.</p>
<p>Changing the server edit method to handle the following type of params:</p>
<p>[oper:edit, field1:test data field1, action:handleEdit, field2:test data field2,</p>
<p>controller:configuration, id:10]</p>
<p>as opposed to the params that the populate method would handle:</p>
<p>[action:handlePopulate, sidx:type, rows:10, _search:false, page:1,</p>
<p>controller:configuration, nd:1261050351812, sord:desc]</p>
</p>
<p>Here are the grails methods that I&#39;ve got working, ported from the demos:</p>
</p>
<pre>	def handlePopulate = {

		println "populateSoftComponents:"+params
		if (params?.rows){
			
			// get how many rows we want to have into the grid 
			// - rowNum parameter in the grid 
			def limit = params.rows?.toInteger()
			
			// Get the requested page. By default grid sets this to 1. 
			def pageNum = params.page?.toInteger()
			
			// get index row - i.e. user click to sort. At first time sort name parameter -
			// after that the index from colModel 
			def sidx = params.sidx?.toLowerCase()
			
			// sorting order - at first time sort order 
			def sord = params.sord
			
			// if we not pass at first time index use the first column for the index or what you want
			if(!sidx) sidx =1;
			
			// calculate the number of rows for the query. We need this for paging the result 
			def count = MyData.count();<br />			
			def total_pages = 0;
			
			// calculate the total pages for the query 
			if( count &#62; 0 &#38;&#38; limit &#62; 0)  
				total_pages = (Math.ceil(count/limit)).toInteger(); 
			
			// if for some reasons the requested page is greater than the total 
			// set the requested page to total page 
			if (pageNum &#62; total_pages) pageNum=total_pages;
			
			// calculate the starting position of the rows 
			def start = limit*pageNum - limit;
			
			// if for some reasons start position is negative set it to 0 
			// typical case is that the user type 0 for the requested page 
			if(start &#60;0) start = 0; 
			
			// the actual query for the grid data 
			def data= MyData.list(max:limit, offset:start, sort:sidx,&#160;
                                        order:sord); 
			
			println "made it here"
						
			// render page of logs as XML markup to the response
			// that jqGrid accepts
			render(contentType:"text/xml") {
				rows {
					page(pageNum)
					total(total_pages)
					records(count)
					for(d in data) {					    
                                               row(id:d.id){
							cell(d.field1)
                                                        cell(s.field2)
						}
					}//for
					
				}//rows
			}//render
			
		}//if params?.rows
	}


        def handleEdit = {
		//Stub : edit the specific record
		// renders text for a specified content-type/encoding
		render(text:"some xml",contentType:"text/xml",encoding:"UTF-8")
	}

</pre>
]]></description>
        	        	<pubDate>Thu, 17 Dec 2009 14:10:31 +0200</pubDate>
        </item>
        <item>
        	<title>asimu on Problems with form editing, editurl and server-side method</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/problems-with-form-editing-editurl-and-server-side-method#p13100</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/problems-with-form-editing-editurl-and-server-side-method#p13100</guid>
        	        	<description><![CDATA[<p>First I have to say that jqGrid is a really excellent component and has helped accelerate the project I&#39;m working on!</p>
<p>I&#39;ve been struggling with adding form based editing into my grid.</p>
<p>I&#39;m using the latest jqGrid 3.6 and I&#39;m using Grails 1.1 on the server side.</p>
<p>I&#39;ve taken the Form Enhancement (3.5) demo as a template and have written a grid that populates</p>
<p>via the &#39;url&#39; correctly but when calling editUrl for either &#39;Add Record&#39; or Edit returns to the&#160;</p>
<p>edit form dialog the following type of error:</p>
<p>&#8220;error Status: &#39;/WEB-INF/grails-app/views/configuration/myEdit.jsp&#39;. Error code: 404&#8243;</p>
<p>The correct grails method is called and I can see it is sent all the correct params, but</p>
<p>a 404 is seen on the form.</p>
<p>Does the server-side method need to return anything special that I&#39;m missing?</p>
<p>Any help would be appreciated.</p></p>
]]></description>
        	        	<pubDate>Thu, 17 Dec 2009 04:26:35 +0200</pubDate>
        </item>
</channel>
</rss>