« Return to Thread: toggling checkbox's enabled field in datagrid

Re: toggling checkbox's enabled field in datagrid

by turbo_vb :: Rate this Message:

| View in Thread

Have you tried this:

<mx:CheckBox id="cb" selected="{ data.fired }" enabled="{ data.type != 0 }" />

-TH

--- In flexcoders@..., "carriecharp" <carriecharp@...> wrote:

>
> I've inherited some code to update and I could use some help.
>
> I have an Advanced Data Grid where one column uses a custom checkbox component. It's very simple with the checkbox's selected field controlled by column's datafield, which is a Boolean named 'fired'.
>
> I want to have the checkbox enabled only in certain situations, dependent upon a second field , an int called 'type'. Basically, enabled = (type!=0).
>
> 'type' is a field in the grid's dataprovider and I want to set the enabled field in the declaration below but I can't figure out how to reference the 'type' field.
>
> Any guidance is appreciated!
> Thanks, Carrie
>
>     <mx:Component id="cbEditor">
>     <mx:HBox horizontalAlign="center" backgroundAlpha="1" width="100%">
>     <mx:Script>
>     <![CDATA[
>     public var selected:Boolean;
>    
>     ]]>
>     </mx:Script>
>     <mx:CheckBox id="cb"  selected="{data.fired}" click="selected=data.fired=cb.selected;" width="15"/>
>     </mx:HBox>
>     </mx:Component>
>


 « Return to Thread: toggling checkbox's enabled field in datagrid