A: 

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.

  1. (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.
  2. I'd also eliminate excess calls to redirect(action: "list") in code.
  3. Looks like you're not using ${id} in list action? If so, you don't have to pass it as list action parameter.
  4. 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
OTOH, how are you planning to undo changes to table row in GUI?
Victor Sergienko
Well, I included textfields to all the elements on the list, so I just need the update button. If you want to undo something you'd have to refresh the page. Good point though.
fgualda87
Each row has it's own `<g:form>` though. And it is still not working. What if in the controller I create a few if(params?.Rcommodity) {...} ??
fgualda87
Sorry, I don't get it. Can you quote table row GSP code and update{} code?
Victor Sergienko
I updated my question with code.
fgualda87
That is the first row that it creates. If you want the code of the first row where everything is created I can post it too but is even longer. I think I am missing something in the def update{} though, more than the actual html code in the gsp
fgualda87
The thing is that I can delete the row, but I cannot update it. I changed the code and I only need to modify one field, all the rest are $fieldValue with always the same data. So the only thing that changes is the density field. I also renamed it to density instead of Rdensity.
fgualda87
Also, I create a template of list name _list.gsp with only the list part
fgualda87