Ganeshflex’s Blog

Just another WordPress.com weblog

Using states getting columns in datagrid in runtime

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”vertical” width=”480″ height=”250″ viewSourceURL=”../nwebb_example_code/dg_change_state_add_cols/srcview/index.html”>
<mx:states>
<mx:State name=”SecretState”>
<mx:SetProperty target=”{label1}” name=”text” value=”ADMIN STATE”/>
<mx:SetProperty target=”{salaryCol}” name=”visible” value=”true”/>
<mx:SetProperty target=”{squirrelCol}” name=”visible” value=”true”/>
</mx:State>
</mx:states>

<mx:Script>
<![CDATA[
private function aaa():void
{
currentState = (currentState == 'SecretState') ? '' : 'SecretState';
}
]]>
</mx:Script>

<mx:Label text=”NORMAL STATE”  id=”label1″/>
<mx:DataGrid width=”100%” height=”100%”>
<mx:columns>
<mx:DataGridColumn headerText=”Name”/>
<mx:DataGridColumn headerText=”Salary” visible=”false” id=”salaryCol”/>
<mx:DataGridColumn headerText=”Secret Squirrel” visible=”false” id=”squirrelCol”/>
<mx:DataGridColumn headerText=”Age”/>

</mx:columns>
</mx:DataGrid>
<mx:Button label=”toggle states” click=”aaa()”/>
</mx:Application>

June 15, 2009 - Posted by ganeshflex | Uncategorized | | No Comments Yet

No comments yet.

Leave a comment