Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-12-2010, 09:12 PM   #1
Registered User
Join Date: Oct 2010
Posts: 1
Exclamation Checkbox in a DataGrid (Problems)

Hi everyone!

This is my first topic, so I'm sorry if I didn't post it in the right place, but I hope you could help me still.

I have a checkbox in a datagrid. The problem comes when I select a checkbox, and then I move to the bottom of my datagrid, when I go back to the top of de datagrid, the checkbox is no more selected. Maybe the pics will help me to explain it:


Here is the code of the datagrid:

<mx:DataGrid width="937" height="242" horizontalCenter="0" variableRowHeight="true" textAlign="center" verticalAlign="middle" id="dg_progfed" editable="true" itemFocusOut="insertMontoHandler_click(event)" dataProvider="{acDGProgFed}" verticalCenter="0">
<mx:DataGridColumn headerText="Programa" dataField="programa" sortable="false" wordWrap="true" textAlign="left" editable="false" id="columnaProg"/>
<mx:DataGridColumn headerText="Monto $" dataField="monto" sortable="false" wordWrap="true" width="150" editable="true" id="columnaMonto">
<mx:TextInput restrict="0-9"/>
<mx:DataGridColumn headerText="¿Opera?" dataField="opera" sortable="false" wordWrap="true" width="90" textAlign="center" editable="false" id="columnaOpera">
<mx:CheckBox label="S/N" click="outerDocument.actualizaSNOperaHandler_click (data.cveprog,this.selected)" selected="{data.sn3 == 'S' ? true : false}"/>


Thank you very much in advance.

Arturo from Mexico
modelo84 is offline   Reply With Quote
Old 10-16-2010, 07:48 PM   #2
Registered User
Join Date: Sep 2010
Location: Sandy, Utah
Posts: 32
Default Problem is ItemRenderer Re-use

This problem occurs because Flex reuses itemRenderers. In other words, you don't get one itemRenderer per row on your datagrid. And, to complicate the problem, you only have itemRenderers for the visible rows. So, when you scroll down to where your upper row's checkbox is no longer visible, and then scroll back up, all sorts of weird things can happen as itemRenderers are re-used.

I would give you some links to read up on this, but I don't have 50 posts yet, and am therefore not able to post them. So, just Google "flex datagrid itemrenderer reuse" and you will get some good information on overriding the set data method.

Ron Grimes
rdgrimes is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:24 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.