Solved

Not able to reduce DataGrid height from owner

Posted on 2011-03-25
3
436 Views
Last Modified: 2012-05-11
Hello Expert,

I am using <mx:DataGrid/> in my component. Initially i put height=0, after calling server i am calculating height and i am increasing the height of DataGrid.There i am trying to decrease from owner height. But i am seeing no effect.

Please could you help me ?
public function set commandDetails(cmdDtls:CommandVO):void
if(cmdDtls.argumentList==null || cmdDtls.argumentList.length==0)
{
  argLbl.includeInLayout = false;
  argLbl.visible = false;
  dG.includeInLayout = false;
  dG.visible = false;
  moreDesc.includeInLayout = false;
  moreDesc.visible = false;
 //owner.height -= dGMaxHeight; 
}else
{
dG.includeInLayout = true;
dG.dataProvider = cmdDtls.argumentList;
var rows:int = cmdDtls.argumentList.length;
var calculatedHeight:int =dG.measureHeightOfItems(0,rows)+dG.headerHeight+2*rows;
if(calculatedHeight > dGMaxHeight)
{
     dG.height = dGMaxHeight;
     dG.rowCount = dG.rowCount - 1;
}
else
{
    dG.height = calculatedHeight;
    //owner.height -= (dGMaxHeight-dG.height)

}

}

<mx:DataGrid headerBackgroundSkin="@Embed(source='/assets/Panel_headerSkin.png')" id="dG" headerStyleName="datagridHeader"  width="675" height="0" variableRowHeight="true"
				  includeInLayout="false" >
			<mx:columns>
				<mx:DataGridColumn width="125" dataField="name" showDataTips="true" dataTipField="name" headerText="Argument Name" wordWrap="true"/>
				<mx:DataGridColumn id="argDesc" width="350" dataField="description" showDataTips="true" dataTipField="description" headerText="Argument Description" wordWrap="true"/>
				<mx:DataGridColumn width="200" dataField="dbRef" headerText="Argument DBRef" wordWrap="true"/>
			</mx:columns>
			</mx:DataGrid>

Open in new window

0
Comment
Question by:Alpita
  • 2
3 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 35219174
I don't know why you need to change the size if you can use includeInLayout, but anyway easist for you to use maxHeight

<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
				xmlns:s="library://ns.adobe.com/flex/spark" 
				xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<mx:DataGrid id="dG" dataProvider="[1,2,3,4,5,6,7,8,9]" width="675" height="100%" maxHeight="0" variableRowHeight="true"
			 includeInLayout="{dG.maxHeight != 0}" visible="{dG.maxHeight != 0}">
	<mx:columns>
		<mx:DataGridColumn width="125" dataField="name" showDataTips="true" dataTipField="name" headerText="Argument Name" wordWrap="true"/>
		<mx:DataGridColumn id="argDesc" width="350" dataField="description" showDataTips="true" dataTipField="description" headerText="Argument Description" wordWrap="true"/>
		<mx:DataGridColumn width="200" dataField="dbRef" headerText="Argument DBRef" wordWrap="true"/>
	</mx:columns>
</mx:DataGrid>
<mx:Button label="Full Size" click="dG.maxHeight = (dG.maxHeight == 0 ? NaN : 0)"/>
<mx:Button label="Fix Size" click="dG.maxHeight = (dG.maxHeight == 0 ? 300 : 0)"/>
</mx:Application>

Open in new window

0
 

Author Comment

by:Alpita
ID: 35403806
Hi Expert,

My App DataGrid is able to reduce the height by calling setTimeOut(setHeight,200) in onResult().

Thanks,
Alpita
0
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 35410309
Ok, use maxHeight attribute it should work well for you
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AdvancedDataGrid 4 358
AS3 Image Edit Package 3 562
Button and button function on separate pages. Possible? 16 414
Flex 3 trace output 13 735
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question