Results 1 to 2 of 2

Thread: Issue with Grails WebFlow and AJAX

  1. #1
    Join Date
    Sep 2010
    Posts
    26

    Default Issue with Grails WebFlow and AJAX

    Hi,

    I'm trying to get a test webflow working via AJAX calls and I am stuck. I'm not sure what I'm missing. It seems like it doesn't understand the path to the template because the <tr id="attributeEdit"> gets blanked out after the webflow renders.

    My view, /application/workcard.gsp, has a table with one row being generated via the template below:

    /attribute/_edit.gsp
    HTML Code:
    <tr id="attributeEdit">
    <td><label title="attributes">ATTR</label></td>
    <td colspan="3">
    	<div>
    		<g:if test="${ msg }">
    			${ msg }
    			
    			<g:remoteLink update="attributeEdit" 
    						  controller="attribute" 
    						  action="ajaxAttributeChanges" 
    						  event="cancel" 
    						  params="${ [ajaxSource: true, execution: params.execution] }">cancel</g:remoteLink>
    		</g:if>
    		<g:else>
    			<g:remoteLink update="attributeEdit" 
    						  controller="attribute" 
    						  action="ajaxAttributeChanges" 
    						  event="edit" 
    						  params="${ [ajaxSource: true] }">edit</g:remoteLink>
    		</g:else>
    	</div>
    </td>
    </tr>
    AttributeController.groovy
    Code:
    class AttributeController {
    
    	def ajaxAttributeChangesFlow = { 
    		
    		edit {
    			action{
    				flow.msg = "We made it through the edit state"
    			}
    			on("success").to("display")
    		}
    		
    		display {
    			render( template: "/attribute/edit", model: [msg: flow.msg] )
    			
    			on("cancel").to("cancel")
    		}
    		
    		cancel()
            }
    }
    I tried /attribute/_edit, edit, _edit with both template and view but they all have the same behavior.

    I turned the debug on in my config for org.codehaus.groovy.grails.webflow but all I get is this:
    Code:
    2011-10-20 20:57:17,247 [http-8080-1] DEBUG servlet.GrailsFlowHandlerMapping  - Looking up Grails controller for URI [/application/workcard]
    2011-10-20 20:57:28,871 [http-8080-1] DEBUG servlet.GrailsFlowHandlerMapping  - Looking up Grails controller for URI [/attribute/ajaxAttributeChanges]
    2011-10-20 20:57:28,971 [http-8080-1] DEBUG persistence.SessionAwareHibernateFlowExecutionListener  - sessionStarting: Binding Hibernate session to flow
    2011-10-20 20:57:28,972 [http-8080-1] DEBUG persistence.SessionAwareHibernateFlowExecutionListener  - paused: Disconnecting Hibernate session
    I found the 'ajaxSource: true, execution: params.execution' stuff on CloudFoundry.
    http://livesnippets.cloudfoundry.com...tml#2.7%20Ajax

    What am I missing? It has to be something simple. Any help or advice is appreciated.
    Last edited by Brian Riley; Oct 20th, 2011 at 08:18 PM.

  2. #2
    Join Date
    Sep 2010
    Posts
    26

    Default

    Ok, answered my own question. The render statement needed to be in the edit state. There was no need for the display state

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •