201212132AM-selectbooleancheckbox converter

ISSUE:

Inside af:Table, one of the af:colum contains af:selectBooleanCheckbox
I am trying to load checkbox value based on column value from database,
<af:column sortProperty="statusFlag" sortable="false"
headerText="Status"
width="106">
<af:selectBooleanCheckbox value="#{row.bindings.statusFlag.inputValue == 'Y' ? true : false}"
simple="true" autoSubmit="true"
immediate="true"/>
</af:selectBooleanCheckbox>
</af:column>
so if status="Y" checkbox is selected else not and that part works fine.
But, checkboxes are not editable, means I can not either select/unselect , its not readonly and its not disabled either but its behaving like that.

SOLUTION:

For the selectBooleanCheckbox to be editable, the value attribute must point on a valid l-value, therefore a bean property having both a get and a set. In your example, the value is a r-value only:
#{row.bindings.statusFlag.inputValue == 'Y' ? true : false}
What you need is to set a converter on your selectBooleanCheckbox that will convert 'N' and 'Y' to false and true respectively. You can achieve that with a prety simple converter class that you can then set on your component using <f:converter/>

Reference:

https://forums.oracle.com/forums/thread.jspa?threadID=716149

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值