显示布尔值为是/否无线电组 [英] display a boolean as a yes/no radio group

查看:105
本文介绍了显示布尔值为是/否无线电组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有几个布尔属性的域类。脚手架功能构建了一个视图,该视图使用这些属性的复选框,但我真的很希望用两个单选按钮(是/否)表示这些属性。什么是最合适的做法(自定义标签可能)?

我最终使用了下面的广播组:

 < g:radioGroup name =amountPayableVariationlabels =['Yes','No']values = ['true','false']value =$ {contractInstance?.amountPayableVariation}> 
< span> $ {it.radio} $ {it.label}< / span>
< / g:radioGroup>


I have a domain class which has a few Boolean properties. The scaffolding feature builds a view which used checkboxes for these properties, but I would really like for these properties to be represented with two radio buttons (Yes/No). What would be the most appropriate way of doing this (a custom tag maybe)?

解决方案

I ended up using the following radio group:

<g:radioGroup name="amountPayableVariation" labels="['Yes','No']" values="['true','false']" value="${contractInstance?.amountPayableVariation}">
<span>${it.radio} ${it.label}</span>
</g:radioGroup>

这篇关于显示布尔值为是/否无线电组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆