aligning a dataGrid in a grid component.
please, in the code below, i would like to align the datagrid in the gridItem with instance 'row5' such that it is align with the other textInput in instances 'row3' and 'row4'?
thanks for any suggestion given..
<mx:Grid paddingTop="4" paddingLeft="4">
<mx:GridRow id="row1">
<mx:GridItem>
<s:Label text="Description:"
paddingTop="5"/>
</mx:GridItem>
<mx:GridItem>
<s:TextArea id="descTI" width="227" height="50"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row2">
<mx:GridItem>
<s:Label text="Name:"
paddingTop="5"/>
</mx:GridItem>
<mx:GridItem colSpan="3">
<s:TextInput id="nameTI" width="227"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row3">
<mx:GridItem>
<s:Label text="Target:"
paddingTop="5"/>
</mx:GridItem>
<mx:GridItem colSpan="3">
<s:TextInput id="targetTI" width="227"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row4">
<mx:GridItem>
<s:Label text="Through level:"
paddingTop="5"/>
</mx:GridItem>
<mx:GridItem colSpan="3">
<s:TextInput id="throughLevTI" width="227" height="20"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row5">
<mx:GridItem colSpan="4">
<s:Label text="Operand:"
paddingTop="5" />
<mx:DataGrid id="attrDG">
<mx:columns>
<mx:DataGridColumn dataField="variable"
width="150"/>
<mx:DataGridColumn dataField="level"
width="150"/>
</mx:columns>
</mx:DataGrid>
</mx:GridItem>
</mx:开发者_如何学运维GridRow>
</mx:Grid>
Check this code: Some tweaks in GridItem, colspan and width and you are done.
<mx:Grid paddingTop="4" paddingLeft="4">
<mx:GridRow id="row1">
<mx:GridItem>
<s:Label text="Description:" paddingTop="5"/>
</mx:GridItem>
<mx:GridItem>
<s:TextArea id="descTI" width="300" height="50"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row2">
<mx:GridItem>
<s:Label text="Name:" paddingTop="5"/>
</mx:GridItem>
<mx:GridItem>
<s:TextInput id="nameTI" width="300"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row3">
<mx:GridItem>
<s:Label text="Target:" paddingTop="5"/>
</mx:GridItem>
<mx:GridItem>
<s:TextInput id="targetTI" width="300"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row4">
<mx:GridItem>
<s:Label text="Through level:" paddingTop="5"/>
</mx:GridItem>
<mx:GridItem>
<s:TextInput id="throughLevTI" width="300" height="20"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow id="row5">
<mx:GridItem>
<s:Label text="Operand:" paddingTop="5" />
</mx:GridItem>
<mx:GridItem>
<mx:DataGrid id="attrDG">
<mx:columns>
<mx:DataGridColumn dataField="variable" width="150"/>
<mx:DataGridColumn dataField="level"
width="150"/>
</mx:columns>
</mx:DataGrid>
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
精彩评论