Ok, one more idea, but not sure about it's performance.
Just use a viewstack with your custom itemrenderer and use a text component
to implement your blank box logic, keeping the text="".
Here is my idea:
<mx:DataGrid id="mygrid" dataProvider="{initDG}" >
<mx:columns>
<mx:DataGridColumn id="grant_year" dataField="grant_year"/>
<mx:DataGridColumn id="cashoutshares" dataField="cashoutshares"
itemRenderer="xxxx.yyyy.MyCheckBox" />
</mx:columns>
</mx:DataGrid>
MyCheckBox.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import com.live.flats.view.assets.FlatAssets;
import mx.controls.Alert;
public function getStackView(value:Object):void {
//return ur view here..
}
]]>
</mx:Script>
<mx:ViewStack selectedChild="{ getStackView( data.cashoutshares) }">
<mx:CheckBox id="aCB" selected="true">
<mx:Text id="aText" text=""/>
<mx:ViewStack>
</mx:HBox>
Thanks,
Manu.
anthony_morsey wrote:
>
> Thanks, but this technique seems to work for all values in the column,
> not just the value in each individual row. It seems that if one of
> the values for grant_year in a column meets the condition, then all
> checkboxes are either hidden or visible. I want to do this row by row
> and turn visible on or off based on the grant_year value in that row.
>
> Any other ideas?
>
> Thanks
>
> --- In [email protected], Manu Dhanda <[EMAIL PROTECTED]> wrote:
>>
>>
>> Here it is:
>> <mx:DataGrid id="mygrid" dataProvider="{initDG}" >
>> <mx:columns>
>>
>> <mx:DataGridColumn id="grant_year" dataField="grant_year"/>
>>
>> <mx:DataGridColumn id="cashoutshares" dataField="cashoutshares"
>> itemRenderer="mx.controls.CheckBox" visible="{!grant_year=='somevalue'
>> implement ur logic here}"/>
>>
>> </mx:columns>
>> </mx:DataGrid
>>
>>
>>
>> anthony_morsey wrote:
>> >
>> > Here is my code:
>> >
>> > <mx:DataGrid id="mygrid" dataProvider="{initDG}" >
>> > <mx:columns>
>> >
>> > <mx:DataGridColumn id="grant_year" dataField="grant_year"/>
>> >
>> > <mx:DataGridColumn id="cashoutshares" dataField="cashoutshares"
>> > itemRenderer="mx.controls.CheckBox" />
>> >
>> > </mx:columns>
>> > </mx:DataGrid
>> >
>> >
>> >
>> > I want to hide the "cashoutshares" column (or turn off the
>> > itemrenderer in that column) based on the data value of "grant_year".
>> >
>> > Thanks
>> >
>> >
>> >
>> >
>> >
>> >
>> > --- In [email protected], "jmfillman" <jmfillman@> wrote:
>> >>
>> >> Anthony,
>> >>
>> >> If you are passing the data from the columns of each row to the
>> >> itemRenderer, you should be able to set visibility conditions
> from the
>> >> itemRenderer.
>> >>
>> >> If you post your code, I or someone else here might be able to
> provide
>> >> a more specific suggestion.
>> >>
>> >> JF
>> >> --- In [email protected], "anthony_morsey" <tmorsey@> wrote:
>> >> >
>> >> > I have a datagrid with multiple columns and rows. One of the
> columns
>> >> > contains a checkbox which is rendered with an itemRenderer.
> I'd like
>> >> > to conditionally hide some of these checkboxes based on values from
>> >> > other columns with the same row.
>> >> >
>> >> > Any ideas?
>> >> >
>> >> > Thanks
>> >> >
>> >>
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
> http://www.nabble.com/hiding-a-cell-within-a-datagrid-dynamically-tp17673007p17688100.html
>> Sent from the FlexCoders mailing list archive at Nabble.com.
>>
>
>
>
>
--
View this message in context:
http://www.nabble.com/hiding-a-cell-within-a-datagrid-dynamically-tp17673007p17703698.html
Sent from the FlexCoders mailing list archive at Nabble.com.