In order to get rid of create.gsp and edit.gsp, your controller's actions should work exactly like in scaffolding, except for save{} and update{} should end with
redirect(action: list)
In order for "Update" buttons to work, every "Update" should submit its form (one line of the table) to "update" action. Everything else about update{} should remain as it was.
That line form should contain all the object properties, for sure.
UPDATE after code sample.
- (EDIT: oh, I keep misreading the code) Why do you need 2 nested g:forms? I'd try to go with one. Just debug what is being submitted to the update action - do
params
contain object fields. - I'd also eliminate excess calls to redirect(action: "list") in code.
- Looks like you're not using ${id} in list action? If so, you don't have to pass it as list action parameter.
- I believe, some day you'll wish to submit table lines via Ajax. For that, enclose each line in a <div id="line${densityInstance.id}">, extract the line into separate template, and submit to another action, say, ajaxUpdate, which will do the same, but end with render(template: 'lineTemplate'). Then replace g:form with g:formRemote update="[success:'line${densityInstance.id}',failure:'line${densityInstance.id}']", and viola. This will also work for "undo" action.
Victor Sergienko
2010-10-22 15:39:05