Adobe Flex / Flash CheckBox Renderer Bug in a DataGrid

In Adobe Flash / Flex, sometimes in a DataGrid or AdvancedDataGrid, when checking multiple checkboxes a previously checked CheckBox will drop the check mark.  This is really annoying and can cause errors.  It’s a documented bug in Flash player that Adobe hasn’t gotten around to fixing.  You can however fix it yourself by supplying a custom item renderer for each column with a checkbox. 

Basically, create your own renderer based on the CheckBox and supply a click and selected function. The click function is the inverse of the dataField and the selected is just the value of the dataField desired.

<mx:AdvancedDataGrid id=”adList  editable=”true  dataProvider=”{aDP}>

                        <mx:groupedColumns>

                        <mx:AdvancedDataGridColumnGroup headerText=”Group1>

                        <mx:AdvancedDataGridColumn editable=”false  headerText=”Col1dataField=”testA/>

                        <mx:AdvancedDataGridColumn textAlign=”center” headerText=”Col2” width=”35” editorDataField=”selected

                              rendererIsEditor=”true” dataField=”check>

                              <mx:itemRenderer>

                                    <mx:Component>

                                          <mx:CheckBox click=”data.check = !data.check” selected=”{data.check}/>

                                    </mx:Component>

                              </mx:itemRenderer>

                        </mx:AdvancedDataGridColumn>

This is bug #16801 in Flash

https://bugs.adobe.com/jira/browse/SDK-16801

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • MySpace
  • Turn this article into a PDF!
  • Reddit
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Leave a Reply

You must be logged in to post a comment.