It's not a bug. Cell renderers are created only for visible objects
in a list control, not for every single item in the list. Renderers
get reused for items in the list, which provides a performance gain
compared to creating a renderer object for every list item. What you
are seeing is a renderer that has been reused for multiple items, but
hasn't been told completely how to transfer its data to and from the
list item. The result is seemingly unpredictable behavior.
You need to set the state of your renderer's checkbox in the setValue
() method, and set the value of the dataprovider field when the user
clicks on the checkbox to change its state. Assuming your
dataprovider has some boolean field that corresponds to the state of
your checkbox control, then in setValue() you should have something
like the following, where "item" is the data object passed to the
function:
myCheckBox.selected = item[getDataLabel()];
In the checkbox's click handler, you should have something like the
following that sets the value of a field in the dataprovider
according to the checkbox state:
listOwner.editField(
getCellIndex().itemIndex, getDataLabel(), myCheckBox.selected);
The listOwner, getCellIndex, and getDataLabel properties are values
that get passed to all cell renderers.
HTH,
Doug
--- In [email protected], "digital_eyezed" <[EMAIL PROTECTED]>
wrote:
>
> Hi,
>
> I have a cellrenderer for a datagrid which has a simple checkbox in
it.
>
> My problem is, when I click the checkbox, another checkbox (which is
> outside the scroll area of the datagrid) is also checked and so on
> every row which is equal to the rowcount of the datagrid.
>
> Is this a bug?
>
> How do I get around this problem?
>
> Best Regards,
>
> Iain (Flex 1.5)
>