Hi, I'm newbie in flex, I have a problem in datagrid. The contents of my
datagrid comes from database, the problem is i wanted to have the height of my
grid to be flexible as the data added in the database. For example, i have 10
items which i wanted to display in my grid, but more than 10, I need to adjust
the height of my datagrid so i would able to see all the entries. What i want
is whenever i add entries in my dbase my datagrid is also adjusting its height
on its own. Is it possible? Please help me. Here is my code:



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
verticalAlign="middle"
backgroundColor="#ffffff"
width="920" height="100%"
usePreloader="false"
creationComplete="feedRequest2.send();byTag.send() ;">

<mx:HTTPService id="byTag"
url="http://dev.mashuparts.com/trampoline/xml/xml_getsamples.php?method=bytag&am
p;tagid={tagid.text}"

useProxy="false"/>

<mx:HTTPService id="feedRequest2"
url="http://dev.mashuparts.com/trampoline/xml/xml_tags.php" useProxy="false"/>




<mx:Script>
<![CDATA[


// Tags Filter - tagsDg.mxml

import mx.events.ListEvent;

private function itemClickEvent(event:ListEvent):void {
TiledSamples.visible = true;
TiledSamplesbyDate.visible = false;
TiledSamplesbyClient.visible = false;
tagid.text=String(dgPosts.selectedItem.id);
tagLabel.text=String(dgPosts.selectedItem.label);
tagLabel.visible = false;
}

public function slideUp():void{
showAllTags.visible = true;
HideAllTags.visible = false;
close.play();
moveUp.play();
moveUp2.play();
moveUp3.play();
}

public function slideDown():void{
showAllTags.visible = false;
HideAllTags.visible = true;
expand.play();
moveDown.play();
moveDown2.play();
moveDown3.play();
}

private function setTag(tid:String, tname:String):void{
tagid.text = tid;
tagLabel.text = tname;
byTag.send();
}



]]>
</mx:Script>


<!-- Sequence and Effects Starts Here -->

<!-- effects for Tag filter - tagsDg.mxml -->

<mx:Resize id="expand" target="{mainCanvas}" heightTo="380" duration="800"/>
<mx:Resize id="close" target="{mainCanvas}" heightTo="79" duration="800"/>

<mx:Move id="moveDown" target="{TiledSamples}" yTo="575" duration="800"/>
<mx:Move id="moveUp" target="{TiledSamples}" yTo="276" duration="800"/>

<!-- Sequence and Effects Ends Here -->


<mx:Canvas id="mainCanvas" width="300" height="79" borderStyle="solid"
cornerRadius="10"
y="175" verticalScrollPolicy="off"
horizontalScrollPolicy="off"
backgroundColor="#f4f5f5"
backgroundAlpha="1.0" x="11">


<mx:Label text="POPULAR TAGS:" fontFamily="Verdana" color="#000000"
fontWeight="bold" y="12" x="17"

fontSize="9"/>

<mx:Label id="adstag" text="Advertising" name="Advertising"
click="setTag('1', tagid.text);"

color="#dc343a" y="32" fontFamily="Verdana" x="17" buttonMode="true"
useHandCursor="true" mouseChildren="false" fontWeight="bold"/>
<mx:Label id="designtag" text="Design" name="Design" click="setTag('3',
tagid.text);" color="#dc343a"

y="32" fontFamily="Verdana" x="87" buttonMode="true" useHandCursor="true"
mouseChildren="false" fontWeight="bold"/>
<mx:Label id="intertag" text="Interactive" name="Interactive"
click="setTag('4', tagid.text);"

color="#dc343a" y="32" fontFamily="Verdana" x="130" buttonMode="true"
useHandCursor="true" mouseChildren="false"

fontWeight="bold"/>
<mx:Label id="postertag" text="Poster" name="Poster" click="setTag('7',
tagid.text);" color="#dc343a"

y="32" fontFamily="Verdana" x="198" buttonMode="true" useHandCursor="true"
mouseChildren="false" fontWeight="bold"/>
<mx:Label id="musictag" text="Music" name="Music" click="setTag('93',
tagid.text);" color="#dc343a" y="32"

fontFamily="Verdana" x="240" buttonMode="true" useHandCursor="true"
mouseChildren="false" fontWeight="bold"/>
<mx:Label id="vidtag" text="Video" name="Video" click="setTag('29',
tagid.text);" color="#dc343a" y="50"

fontFamily="Verdana" x="17" buttonMode="true" useHandCursor="true"
mouseChildren="false" fontWeight="bold"/>

<mx:Button id="showAllTags" label="VIEW ALL TAGS" click="slideDown()"
x="194" y="51" borderColor="#c52127"
fillColors="[#ed252f, #c52127]" alpha="1.0" fillAlphas="[1.0, 1.0]"
height="12" fontSize="6"

width="80" color="#ffffff"/>
<mx:Button id="HideAllTags" label="VIEW ALL TAGS" click="slideUp()" x="194"
y="51" borderColor="#c52127"

visible="false"
fillColors="[#ed252f, #c52127]" alpha="1.0" fillAlphas="[1.0, 1.0]"
height="12" fontSize="6"

width="80" color="#ffffff"/>


<mx:Label id="tagid" x="115" y="10" text="" width="81" visible="false"/>

<mx:Canvas id="otherTags" width="300" height="450"
backgroundColor="#f4f5f5" y="78"
backgroundAlpha="1.0" visible="true" horizontalScrollPolicy="off"
verticalScrollPolicy="off"
x="-2" borderStyle="solid" cornerRadius="3">
<mx:Canvas x="10" y="15" width="280" height="450"
backgroundColor="#d6d9d4"
horizontalScrollPolicy="off" verticalScrollPolicy="off">

<mx:DataGrid id="dgPosts" y="-23" width="260" height="450"

dataProvider="{feedRequest2.lastResult.tags.tag}"
verticalScrollPolicy="off" horizontalCenter="0"
alternatingItemColors="[#d6d9d4, #e6e9e4]"
borderColor="#d6d9d4" itemClick="itemClickEvent(event);slideUp();"
creationCompleteEffect="resize1" click="byTag.send();lblResults();">
<mx:columns>
<mx:DataGridColumn dataField="label"/>
</mx:columns>
</mx:DataGrid>
</mx:Canvas>
</mx:Canvas>
</mx:Canvas>


<!-- Tile List for Samples by Tag Starts Here -->

<mx:Label id="tagLabel" text="" visible="false" x="389" y="257" width="190"
color="#ff0000" fontWeight="bold"

fontFamily="Arial"/>

<mx:Canvas id="TiledSamples" width="864" visible="false"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
borderStyle="inset" y="276" horizontalCenter="0">

<mx:TileList id="tileListbottom"
dataProvider="{byTag.lastResult.samples.sample}"
columnWidth="216"
columnCount="4"
rowCount="2"
maxRows="2" maxColumns="4"
rowHeight="250"
themeColor="haloSilver"
verticalScrollPolicy="off">

<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center"
verticalAlign="middle" horizontalScrollPolicy="off"
verticalScrollPolicy="off">

<mx:Canvas width="216" backgroundColor="#ffffff"
horizontalScrollPolicy="off"

verticalScrollPolicy="off" top="0">
<mx:Image source="{data.file}" width="200" height="161"
verticalAlign="middle"

horizontalAlign="center" verticalCenter="0"/>
</mx:Canvas>

<mx:Canvas width="216" backgroundColor="#f4f5f5" top="24"
verticalCenter="0" bottom="0" left="0" horizontalScrollPolicy="off"
verticalScrollPolicy="off">
<mx:Label text="Tags:" textAlign="left" left="0" fontWeight="bold"
x="0"/>
<mx:Label text="{data.tag}" width="160" height="59" textAlign="left"
fontWeight="bold" bottom="0" color="#ff0000" x="37"/>
</mx:Canvas>

</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:Canvas>


</mx:Application>