Why is it inside a HBox container? Take it out of the HBox container
and see if that helps.
On 23/03/2009, at 3:45 PM, Annette Spooner wrote:
Hi,
I am trying to use constraint based layout to have a datagrid adjust
in size as the browser window is resized. I have put together a
simplified example below, but it is not working. When the
application is first displayed, the datagrid does not stretch to
fill the width or height of the window. When I resize the window to
be smaller then the datagrid, the datagrid simply disappears off the
edge. Can you tell me what I am doing wrong please?
Thanks,
Annette
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
horizontalAlign="left"
horizontalScrollPolicy="off"
creationComplete="initApp();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import ascomponents.City;
private var cities:Array;
[Bindable] public var citiesView1: ArrayCollection;
public function initApp():void
{
cities
= new Array();
cities
[0] = new City("Sydney", "NSW", "2000", "Australia");
cities
[1] = new City("Melbourne", "VIC", "3000", "Australia");
cities
[2] = new City("Brisbane", "QLD", "4000", "Australia");
citiesView1
= new ArrayCollection(cities);
}
]]>
</mx:Script>
<mx:HBox>
<mx:DataGrid id="testdg1"
dataProvider="{citiesView1}" editable="true" rowCount="5"
width="100%" height="100%" left="0" right="0" top="0" bottom="0">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="name"
editable="false"/>
<mx:DataGridColumn headerText="State/Pcode" dataField="state"
editable="true" />
<mx:DataGridColumn headerText="Country" dataField="country"
editable="true"/>
<mx:DataGridColumn headerText="Name" dataField="name"
editable="false"/>
<mx:DataGridColumn headerText="State/Pcode" dataField="state"
editable="true" />
<mx:DataGridColumn headerText="Country" dataField="country"
editable="true"/>
</mx:columns>
</mx:DataGrid>
</mx:HBox>
</mx:Application>
package ascomponents
{
public class City
{
public var name:
String;
public var state:
String;
public var
postcode:String;
public var
country:String;
public function
City(n:String, s:String, p:String, c:String)
{
name
= n;
state = s;
postcode = p;
country = c;
}
}
}