Wednesday, April 07, 2010

Copy functionality in Grails application

Following is easy code you can implement a Grails application to implement copy functionality:-

list.gsp

The primary key is passed as a parameter to the create action which effectively creates a blank template and fills up with existing record

<td><g:link action="create" params="${processParamAssignInstance.getPK()}">Copy</g:link></td>


Domain class



Here defPK contains all the variables which make up the composite key of the domain class



def getPK(){
["workCenterCode":workCenterCode,"mfgAreaLoc":mfgAreaLoc,"oper":oper,"processParamTemplate":processParamTemplate,"fab":fab,"matchValue":matchValue,"paramName":paramName]
}

No comments:

Post a Comment

Thank you for your feedback