So for instance your gsp with
Will show a form for all the fields on a Bean.<fieldset class="form"> <f:all bean="project"/> </fieldset>
And the following will show a table view
But what if you want to override the styling, that is easy!<f:table collection="${projectList}" />
But where do you start, it took me a while to find the default templates that are used, you can find them in the plugin.
So right here is the tables one:
<table> <thead> <tr> <g:each in="${domainProperties}" var="p" status="i"> <g:set var="propTitle">${domainClass.propertyName}.${p.name}.label</g:set> <g:sortableColumn property="${p.name}" title="${message(code: propTitle, default: p.naturalName)}" /> </g:each> </tr> </thead> <tbody> <g:each in="${collection}" var="bean" status="i"> <tr class="${(i % 2) == 0 ? 'even' : 'odd'}"> <g:each in="${domainProperties}" var="p" status="j"> <g:if test="${j==0}"> <td><g:link method="GET" resource="${bean}"><f:display bean="${bean}" property="${p.name}" displayStyle="${displayStyle?:'table'}" /></g:link></td> </g:if> <g:else> <td><f:display bean="${bean}" property="${p.name}" displayStyle="${displayStyle?:'table'}" /></td> </g:else> </g:each> </tr> </g:each> </tbody> </table>
This comment has been removed by the author.
ReplyDelete