Solved

Not able to reduce DataGrid height from owner

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

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…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

28 Experts available now in Live!

Get 1:1 Help Now