Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Not able to reduce DataGrid height from owner

Posted on 2011-03-25
3
Medium Priority
?
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 35410309
Ok, use maxHeight attribute it should work well for you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Let's take a look into the basics of ransomware—how it spreads, how it can hurt us, and why a disaster recovery plan is important.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

636 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