Grails Update a List in GSP (View) and then submit with a button -


Imagine that you have a table displaying a list of books (like indexes) and you make changes to columns Want to "sell" (for example a checkbox). So when you "examine" the books you sold, click a button to save you! How can I send that list back to the controller and update it?

So, there is something like this in the controller:

def aMethod () {... [bookInstanceList: myBookList]}

In GSP:

  & lt; Each = "$ {bookInstanceList}" status = "i" var = "bookInstance" & gt; & Lt; Tr square = "$ {(i% 2) == 0? Even ':' weird '}" & gt; & Lt; TD & gt; & Lt; Six Link Action = "Show" id = "$ {bookInstance.id}" & gt; $ {FieldValue (bean: bookInstance, area: "author")} & lt; / G: Link & gt; & Lt; / Td> & Lt; Td> & Lt; G: checkbox name = "sold" value = "$ {bookInstance .. sold}" /> gt; & Lt; / Td> & Lt; TD & gt; & Lt; / TR & gt; & Lt; / G: each & gt;  

This idea is with the checkbox to allow users to change the "SOLD" value from that book, and then submit it with a button How can I save my new bookInstanceList?

Thank you very much

is not a simple sample app where you can do it There are a way to discover. Run the app, open the default index page, click the link and it will take you to the page where you can click on the checkbox and update the library of books.

There are files of interest and.

I hope that helps.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -