I made a custom control to show a datagrid on a canvas that has + and - buttons to insert and delete rows. The master component is the canvas for obvious reasons, so to pass data to sub-components I defined generic interfaces (array, arraycollection, and string) which I am then binding to from the nested DataGrid. From outside I can just use <ns1:columns> and then fill it with standard <mx:DataGridColumn>. It works great, I am just a little concerned, that I might be heading for trouble down the road, or that there may be better ways to do this. Thoughts?
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" cornerRadius="5" borderStyle="solid" borderColor="#c0c0c0" backgroundColor="#e2e2e2" backgroundAlpha="0.5">
<!-- exposed properties -->
<mx:Array id="columns"></mx:Array>
<mx:ArrayCollection id="dataProvider"></mx:ArrayCollection>
<mx:String id="label">AutoGrid</mx:String>
<!-- Visuals -->
<mx:Label x="10" y="10" text="{label}" fontWeight="bold"/>
<mx:Button y="10" label="+" fontWeight="bold" width="18" height="18" borderColor="#e0dfe3" alpha="0.49" fillColors="[#e7e7cf, #808040]" fillAlphas="[1.0, 0.6]" right="30"/>
<mx:Button y="10" label="-" fontWeight="bold" width="18" height="18" alpha="0.49" fillColors="[#e7e7cf, #808040]" fillAlphas="[1.0, 0.6]" right="10"/>
<mx:DataGrid columns="{columns}" dataProvider="{dataProvider}" left="10" right="10" bottom="10" top="34" />
</mx:Canvas>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Software development tool | Software development | Software development services |
Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___