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 itemRenderer CheckBox 的使用
- Using a CheckBox control as a list item renderer in Flex
- 理解Flex itemRenderer(2)--外部渲染器
- 理解Flex itemRenderer(3)--通信
- Flex Tree 之 TreeItemRenderer
- Flex lets you define item renderers and item editors in three different ways:
- 理解 Flex itemRenderer - 第 1 部分: 内联渲染器
- 理解Flex itemRenderer(2)--外部渲染器
- 理解Flex itemRenderer(3)--通信
- 理解 Flex itemRenderer - 第 1 部分: 内联渲染器
- Creating a radio button item renderer on a Spark List control in Flex 4
- flex4使用itemrenderer后报Error #1009
- 理解 Flex itemRenderer - 第 2 部分: 外部渲染器
- Flex手机项目继承IconItemRenderer自定义List组件
- Flex itemRenderer
- 理解Flex itemRenderer(2)--外部渲染器
- 理解Flex itemRenderer(4)--状态和过渡
- 理解Flex itemRenderer(5)--效率
- Flex datagrid itemrenderer刷新显示错乱问题
- 理解 Flex itemRenderer - 第 2 部分: 外部渲染器