actionscript 3 - Action Script 3, Grid and GridRow in Action Script -
i want create 1 table in flex contains sub sections,colspans , rowsans.
build <mx:grid> , <mx:gridrow> hardcoded in flex, want build dynamically action script.
i not sure how build it. sample code need convert action script
<mx:grid id="metricsgrid" stylename="grid" backgroundcolor="blue" horizontalalign="center" width="100%" height="100%"> <mx:gridrow id="cashmetricsgridheaderrow" > <mx:griditem colspan="3" stylename="griditem" verticalalign="middle" horizontalalign="center" > <mx:label text="{ gettodaysdatewithtitle() }" stylename="boldfontweight"></mx:label> </mx:griditem> </mx:gridrow> <mx:gridrow id="metricsgridrow1" bordercolor="black"> <mx:griditem rowspan="3" stylename="griditem" verticalalign="middle" horizontalalign="center" > <mx:label text="abc" height="50" stylename="boldfontweight"></mx:label> </mx:griditem> <mx:griditem rowspan="3" stylename="griditem" verticalalign="bottom" horizontalalign="center" > <mx:label text="total" height="50" stylename="boldfontweight"></mx:label> </mx:griditem> <mx:griditem rowspan="3" stylename="griditem" verticalalign="middle" horizontalalign="center" > <mx:label text="xyz" stylename="boldfontweight"></mx:label> </mx:griditem> </mx:gridrow> </mx:grid>
if need other information please let me know. highly appreciate. thanks.
something following should started. call creategrid()
createchildren()
override or initialize
event listener.
note variables declared here need class variables make them accessible.
private function creategrid() { var metricsgrid:grid = new grid(); //set other properties on metricsgrid var cashmetricsgridheaderrow:gridrow = new gridrow(); //set other properties on metricsgrid var item:griditem = new griditem(); //set other properties on griditem var label:label = new label(); label.text = gettodaysdatewithtitle(); item.addelement(label); cashmetricsgridheaderrow.addelement(item); metricsgrid.addelement(cashmetricsgridheaderrow); this.addelement(grid); }
Comments
Post a Comment