1 Reply Latest reply on Aug 14, 2006 5:01 PM by papalarge

    Datagrids and viewstack with creationPolicy="all"

    papalarge
      When I load the datagrid beforehand, using a viewstack and creationpolicy="all", the datagrid I'm displaying doesn't take into account the widths for the column I've specified. If I remove "creationpolicy="all"", and let it default to "auto", the widths appear correct. Any ideas why this is occurring? Below is a sample of my datagrid...

      <mx:DataGrid id="myGrid" dataProvider="{hsDocTypes2.lastResult.DocType}" variableRowHeight="true" verticalGridLines="False" styleName="userTable" bottom="0" top="20" left="0" right="0">
      <mx:columns>
      <mx:DataGridColumn dataField="@Count" width="30" textAlign="center" sortable="false" headerText="" color="#cccccc" paddingLeft="10"/>
      <mx:DataGridColumn dataField="@Name" headerText="DOCTYPE" headerRenderer="components.RendererDisplayHeader" color="#ccffff" paddingLeft="10"/>
      <mx:DataGridColumn headerText="INPUT" width="60" dataField="@Input" sortable="false" headerRenderer="components.RendererDisplayHeader" paddingLeft="0" textAlign="center"/>
      <mx:DataGridColumn headerText="SEARCH" width="70" dataField="@Search" sortable="false" headerRenderer="components.RendererDisplayHeader" paddingLeft="0" textAlign="center"/>
      <mx:DataGridColumn width="90" sortable="false" headerStyleName="displayHeader">
      <mx:itemRenderer>
      <mx:Component>
      <mx:HBox>
      <mx:LinkButton label="edit"/>
      <mx:LinkButton label="del"/>
      </mx:HBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      </mx:columns>
      </mx:DataGrid>
        • 1. Re: Datagrids and viewstack with creationPolicy=&quot;all&quot;
          papalarge Level 1
          Here's an example app of what I'm talking about... remove the "creationPolicy="all" " on the viewstack, and you'll see what I mean... I want the first column to be a width of only 10... but for some reason, it's not being rendered correctly.

          Ideas?


          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="*">

          <mx:Script>
          <![CDATA[
          private var oXML:XML =
          <root>
          <node Count="1" Name="Test"/>
          <node Count="2" Name="Test2"/>
          </root>

          ]]>





          </mx:Script>
          <mx:ViewStack creationPolicy="all" id="viewstack1" styleName="vsMain" height="100%" width="100%">
          <mx:Canvas label="Canvas 1"/>
          <mx:Canvas label="Canvas 2">
          <mx:DataGrid id="myGrid" dataProvider="{oXML.node}" bottom="10" top="10" right="-10" left="200">
          <mx:columns>
          <mx:DataGridColumn dataField="@Count" width="30"/>
          <mx:DataGridColumn dataField="@Name" headerText="DOCTYPE"/>
          </mx:columns>
          </mx:DataGrid>
          </mx:Canvas>
          </mx:ViewStack>
          <mx:Canvas width="190" backgroundColor="#445B73" bottom="0" left="0" top="0">
          <mx:ToggleButtonBar verticalGap="15" verticalAlign="top" direction="vertical" dataProvider="viewstack1" bottom="0" buttonHeight="30" right="10" left="10" top="10">
          </mx:ToggleButtonBar>
          </mx:Canvas>

          </mx:Application>