In the example below I'm hiding/showing columns when you switch between states. The problem is every time I switch between the states the columns that are hidden shrink a little more each time the visibility is turned back on.

 

Anyone know how to get the dataGrid to stop resizing the columns, and to honor the hard coded width values? Or what method to call on the datagrid to make it re-calculate the column widths again?

 

thanks,

---mike

 

code:

-------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" currentState="s1">
 
 <mx:Script>
  <![CDATA[
   [Bindable]
   public var dp:Array = [{a:"123", b:"abc", c: "[EMAIL PROTECTED]", d:"ABC123"},{a:"123", b:"abc", c: "[EMAIL PROTECTED]", d:"ABC123"},{a:"123", b:"abc", c: "[EMAIL PROTECTED]", d:"ABC123"},{a:"123", b:"abc", c: "[EMAIL PROTECTED]", d:"ABC123"}]
  ]]>
 </mx:Script>
 
 <mx:states>
  <mx:State name="s1"/>
  <mx:State name="s2">
   <mx:SetProperty target="{test1}" name="width" value="500"/>
   <mx:SetProperty target="{test1}" name="height" value="500"/>
   <mx:SetProperty target="{b}" name="visible" value="false"/>
   <mx:SetProperty target="{d}" name="visible" value="false"/>
  </mx:State>
 </mx:states>
 
 
 <mx:HBox>
  <mx:Button label="state1" click="this.currentState='s1'"/>
  <mx:Button label="state2" click="this.currentState='s2'"/>
 </mx:HBox>
 
 <mx:DataGrid id="test1" dataProvider="{dp}">
  <mx:columns>
   <mx:DataGridColumn id="a" dataField="a" headerText="A Column" width="75"/>
   <mx:DataGridColumn id="b" dataField="b" headerText="B Column" width="75"/>
   <mx:DataGridColumn id="c" dataField="c" headerText="C Column" width="200"/>
   <mx:DataGridColumn id="d" dataField="d" headerText="D Column" width="75"/>
  </mx:columns>
 </mx:DataGrid>
</mx:Application>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to