Hi Guys: I would like to share you how to make AutoComplete and Multiple Select from one DataProvider in this case is ArrayCollection.
http://teapoci.blogspot.com/2010/01/autocomplete-from-arraycollection-data.html If there's any bugs or error please report me. I hope admin will not ban me, it is for educational purpose only for people who dont know AS3/Flex greatly. Regards, Reinhart --- On Wed, 1/20/10, aramsdell2000 <[email protected]> wrote: From: aramsdell2000 <[email protected]> Subject: [flexcoders] Re: Datagrid itemrenderer for adding multiple linkbuttons in same gridcolumn To: [email protected] Date: Wednesday, January 20, 2010, 1:49 PM Oh wow, this looks great! Thank you! This looks like what I want to do, just curious, how do I cite it if I use it/ modified version of it?? I can add a link to his website and blog in the code? --- In flexcod...@yahoogro ups.com, "valdhor" <valdhorlists@ ...> wrote: > > Here is a quick and dirty example using the hyperlink component from > jabbypanda (http://jabbypanda. com/labs/ hyperLink/ srcview/index. html): > > <?xml version="1.0" encoding="utf- 8"?> > <mx:Application xmlns:mx="http://www.adobe. com/2006/ mxml" > layout="absolute" width="700"> > <mx:Script> > <![CDATA[ > import mx.collections. ArrayCollection; > > [Bindable] public var initDG:ArrayCollect ion = new > ArrayCollection( [ > {Company: 'Apple Computer', WebSites: > 'www.apple.com, store.apple. com,developer. apple.com' }, > {Company: 'Google', WebSites: > 'www.google. com,code. google.com, mail.google. com'} > ]); > ]]> > </mx:Script> > <mx:DataGrid id="myGrid" dataProvider= "{initDG} " > rowCount="{initDG. length}"> > <mx:columns> > <mx:DataGridColumn width="120" dataField="Company" > editable="false" /> > <mx:DataGridColumn width="500" dataField="WebSites " > itemRenderer= "Renderers. LinksRenderer" /> > </mx:columns> > </mx:DataGrid> > </mx:Application> > > LinksRenderer. as: > package Renderers > { > import flash.net.*; > import htmltext.controls. HyperLink; > import htmltext.controls. events.Hyperlink Event; > import mx.containers. HBox; > > public class LinksRenderer extends HBox > { > private var link1:HyperLink = new HyperLink(); > private var link2:HyperLink = new HyperLink(); > private var link3:HyperLink = new HyperLink(); > > public function LinksRenderer( ) > { > super(); > } > > override public function set data(value:Object) :void > { > super.data = value; > if(value != null) > { > var linksArray:Array = data.WebSites. split("," ); > link1.linkText = linksArray[0] ; > link1.addEventListe ner(HyperlinkEve nt.HYPERLINK_ CLICK, > hyperLinkClicked) ; > link2.linkText = linksArray[1] ; > link2.addEventListe ner(HyperlinkEve nt.HYPERLINK_ CLICK, > hyperLinkClicked) ; > link3.linkText = linksArray[2] ; > link3.addEventListe ner(HyperlinkEve nt.HYPERLINK_ CLICK, > hyperLinkClicked) ; > addChild(link1) ; > addChild(link2) ; > addChild(link3) ; > } > } > > private function hyperLinkClicked( event:HyperlinkE vent):void > { > navigateToURL( new URLRequest(" http://" + > event.target. linkText) , '_blank'); > } > } > } > --- In flexcod...@yahoogro ups.com, Tino Dai <oberoc@> wrote: > > > > Have you looked at the class LinkBar? I think that would be a good way > to > > return a multiple buttons in a cell of a datagrid. > > > > http://livedocs. adobe.com/ flex/3/langref/ mx/controls/ LinkBar.html > > > > -Tino > > > > > > On Wed, Jan 13, 2010 at 10:11 AM, aramsdell2000 > aramsdell2000@ ...: > > > > > > > > > > > OK, that's the problem. I don't know how to add multiple link > buttons > > > through action script. And here goes my feeble attempt at explaining > what I > > > did so that it makes sense: > > > > > > This is how I am now populating the column with multiple hyperlinks, > using > > > the itemrenderer approach from Alex's Flex Closet "HTML in an Item > Renderer" > > > on this website: > > > http://blogs. adobe.com/ aharui/item_ renderers/ > > > > > > var params:Array = (data[column. dataField] ).split(" , "); > > > var urls:String = ""; > > > for (var i:Number=0; i < params.length; i++) > > > { > > > ... > > > urls += "<a href='http://webaddress? charname=" > > > + params[i] > > > + "&someid= " > > > + station > > > + "&anotherid= " > > > + org > > > + "' target='_blank' >" + params[i] + "</a>, "; > > > } > > > ... > > > cdataTag = urls; > > > ..... > > > htmlText = cdataTag; > > > > > > but only a right click works to open a new window. I would like it > to work > > > with just clicking on the text like a normal HTML href. > > > > > > So what I wanted to do was have each string be a link button (except > i > > > don't really like the fact that it looks like a button). I have been > > > experimenting with using a single linkbutton in a datagridcolumn for > > > something similar: > > > > > > else if (column.dataField == "details"){ > > > var linkItemRendererFac tory:ClassFactor y = new > ClassFactory( LinkButton) ; > > > > > > var someid:String = data["someid" ]; > > > var anotherid:String = data["anotherid" ]; > > > > > > var queryExpr:String = "&SomeParameterId= " + someid + > > > "&AnotherParameterI d=" + anotherid + "restofurl"; > > > //this line isn't quite working either but I hope you get the idea.. > > > //linkItemRendererF actory.propertie s = > > > {label:data[ column.dataField ],click:" callGetDetailsWe bService( " + > queryExpr > > > + ");"}; > > > > > > linkItemRendererFac tory.properties = {label:data[ column.dataField ]}; > > > column.itemRenderer = linkItemRendererFac tory; > > > > > > I am not sure how to expand the above code to add multiple buttons. > Instead > > > of using an inline? renderer, do I have to make a new link button > class and > > > extend it or can I somehow write it into the custom > > > CustomDataGridItemR enderer class I have now that extends > > > DataGridItemRendere r. > > > > > > Hopefully that makes sense! > > > > > > Thanks! > > > Amy > > > > > > > > > --- In flexcod...@yahoogro ups.com <flexcoders% 40yahoogroups. com>, > Tino Dai > > > oberoc@ wrote: > > > > > > > > Some code would help > > > > > > > > On Tue, Jan 12, 2010 at 8:36 PM, aramsdell2000 amy.ramsdell@ wrote: > > > > > > > > > > > > > > > > > > > > > > I have a datagrid column that for each row, has several text > values > > > each > > > > > with its own hyperlink. > > > > > > > > > > Ex: the data in the datafield looks like: "Atext, Btext, Ctext". > As it > > > is > > > > > now, I was able to add href anchor tags but they only open in a > new > > > window > > > > > with the right mouse click. The datagrid item click event takes > over > > > the > > > > > left mouse click and I am not sure how to prevent that. So I > thought I > > > would > > > > > add multiple link buttons in the datagrid column instead. My > question > > > is how > > > > > to add these multiple buttons using an itemrenderer in > actionscript. If > > > I > > > > > was adding just one I would assume it would be > datagrdcol.itemrend erer > > > = new > > > > > ClassFactory( LinkButton) and then you just set the properties of > the > > > link > > > > > button. But how do you do it if there are multiple buttons for > the data > > > in > > > > > the datafield. Do you extend the LinkButton or list data in a > > > > > customitemrenderer class? How? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >

