Reputation: 158
I am trying to use template to apply to my scaffolding of f:table. However I do not know how to access the information of each line of my table in order to properly write my template. For simple fields, I have bean, property,label, and such but I cannot find any documentation pointing out how to access information for f:table. Please help me out guys ! Grails 3.1.x
Upvotes: 1
Views: 2858
Reputation: 4518
The documentation for this plugin is a bit sketchy. The part you are looking for is in section Customizing Field Rendering.
The particular table you are looking for (containing value
, bean
, etc. parameters) is called Template parameters.
Upvotes: -1
Reputation: 39907
See, if this sample below can provide you some hint.
<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>
Taken from the Github page.
Upvotes: 5