我在gsp中有一个包含10个deiiferent值的表:
<table class="table table-striped">
<tr>
<th scope="row">Name:</th>
<td>
${person.name}
</td>
</tr>
<tr>
<th scope="row">Address:</th>
<td>
${person.address}
</td>
</tr>............
我需要突出显示(如果某些值存在于gsp中可用的数组中,请更改某些值的背景或文本格式。
这可能吗?例如使用g:if?喜欢 :
<tr>
<th scope="row">Name:</th>
<td>
<g:if ${array}.contains("${person.name}")>
//change styling of this cell
${person.name}
</g:if>
</td>
</tr>
最佳答案
这应该可以,但是我还没有尝试过:
<td class="${array.contains( person.name ) ? 'highlight' : ''}">
因此,如果包含名称,则将“highlight”类添加到
td
关于grails - 如果表行颜色在gsp中包含某个值,是否可以更改表行颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16567114/