开发者

flex checkbox value not selected from database

开发者 https://www.devze.com 2022-12-31 18:56 出处:网络
I have a small flex datagrid. The dataProvider is an xmlList. I have two columns, userList and user permissions. The user permissions column

I have a small flex datagrid. The dataProvider is an xmlList. I have two columns, userList and user permissions. The user permissions column as checkboxes. The values for the checkbox are stored as 0 and 1 in mySQL. While returning it from PHP, I am converting them to true or false. Its returning the values correctly to the frontend.

But inside the itemrenderer, the checkbox is not being set to true or false. Either everything is true or everything is false.

Here is my code开发者_StackOverflow. http://www.freeimagehosting.net/uploads/4ba76933d3.gif

How can I correctly set the value of the checkboxes from the DB values?

Please help.


Change

<mx:CheckBox selected="{data.@selected}"/>

to

<mx:CheckBox selected="{Boolean(Number(data.@selected))}"/> (corrected thanx to Amarghosh)

and it should work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号