您的位置:首页 > 其它

Flex ItemRenderer CheckBox Sample

2010-07-16 17:10 211 查看
 

I have run across a lot of posts from people having problems getting checkboxes to properly work in itemrenderers in Flex 2. Here's an easy to follow sample that works. It displays a datagrid with four columns, the first two are just plain text columns, the third contains a checkbox that is bound to the underlying dataprovider and the fourth shows the text value of the boolean from the third column (just so you can see the value is really changing). Change some of the values, scroll up and down, everything stays the way it should, no mystery checks where they do not belong. Following is the actual code for the itemrenderer column, pretty easy. The click event just flips the bound value to the opposite of what it was.

<mx:DataGridColumn headerText="Online" dataField="online">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox click="data.online=!data.online"  selected="{data.online}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
 

Hope this helps out, stay tuned for more datagrid help.

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  flex datagrid scroll up