https://sites.google.com/site/adobeflex45/system/app/pages/admin/attachments/SparkDatagridItemrender.mxml
<?xml version="1.0" encoding="utf-8"?>
<s: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">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:ArrayList id="tourdata">
<fx:Object sno="1" TourName="Atlanta to Nashville" price="237.50"></fx:Object>
<fx:Object sno="2" TourName="Miami to Tampa" price="197.87"></fx:Object>
<fx:Object sno="3" TourName="Chicago to california" price="637.87"></fx:Object>
<fx:Object sno="4" TourName="Las vegas to New york" price="777.54"></fx:Object>
</s:ArrayList>
</fx:Declarations>
<s:DataGrid x="45" y="52" width="451" height="161" dataProvider="{tourdata}"
requestedRowCount="4">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="sno" headerText="S.No"></s:GridColumn>
<s:GridColumn dataField="TourName" headerText="Tour Name"></s:GridColumn>
<s:GridColumn dataField="price" headerText="Price" itemRenderer="Renders.PriceRender"></s:GridColumn>
</s:ArrayList>
</s:columns>
</s:DataGrid>
</s:Application>
Itemrender:
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" clipAndEnableScrolling="true">
<!--delete script section not required-->
<!--<fx:Script>
<![CDATA[
override public function prepare(hasBeenRecycled:Boolean):void {
lblData.text = data[column.dataField]
}
]]>
</fx:Script>-->
<fx:Declarations>
<s:CurrencyFormatter id="priceFormatter" useCurrencySymbol="true"/>
</fx:Declarations>
<s:layout>
<s:HorizontalLayout horizontalAlign="right" verticalAlign="middle" paddingRight="7"/>
</s:layout>
<s:Label id="lblprice" text="{priceFormatter.format(data.price)}"/>
Spark Itemrender |
No comments:
Post a Comment