Created
March 28, 2011 21:58
-
-
Save ThomasBurleson/891377 to your computer and use it in GitHub Desktop.
Flex ItemRenderers - global data usages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<mx:DataGrid width="100%" height="100%" | |
xmlns:mx="http://www.adobe.com/2006/mxml" > | |
<mx:Script> | |
<![CDATA[ | |
/** | |
* Array of localized, marker labels | |
*/ | |
public var availableMarkers : Array = [ ]; | |
/** | |
* Utility method used by each itemRenderer instance; | |
* obviates need to inject markers INTO each instance. | |
* | |
* @param j GroupID used as index into string array | |
* @return String Marker label for the specified groupID | |
*/ | |
public function lookupMarker(j:uint):String { | |
return (j < availableMarkers.length) ? String(availableMarkers[j]) : ""; | |
} | |
]]> | |
</mx:Script> | |
<mx:columns> | |
<mx:DataGridColumn width="55" headerText="Marker"> | |
<mx:itemRenderer> | |
<mx:Component> | |
<mx:Label text="{ outerDocument.lookupMarker(data.groupId) }" /> | |
</mx:Component> | |
</mx:itemRenderer> | |
</mx:DataGridColumn> | |
</mx:columns> | |
</mx:DataGrid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment