<g:javascript library="prototype" />
…
<g:remoteLink action="showDetail" id="${messageInstance?.id}"
update="details" >
${messageInstance.author.fullName} - ${messageInstance.subject}
</g:remoteLink>
The final attribute that we
set on the <g:remoteLink> tag is update. This attribute contains the ID of the HTML element on this page that will be updated with the result of the action—in this case, details.
In the method in action
def showDetail = {
def messageInstance = Message.get(params.id)
if (messageInstance) {
render(template:"details" , model:[messageInstance:messageInstance])
}
else {
render "No message found with id: ${params.id}"
}
}
No comments:
Post a Comment