Solved

Not able to reduce DataGrid height from owner

Posted on 2011-03-25
3
429 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now