Yup. Also, I'm not familiar with getNumberAt(). The collection API uses getItemAt(), or you can use bracket notation.
-TH --- In [email protected], Michelle Davis <[EMAIL PROTECTED]> wrote: > > Hi Tim, > Now I know why when I tried labelFunction and "getNumberAt". It didn't work the first time. The reason is I had only 1 argument in labelFunction.privatefunctiongetLabelUnit2(item:Object): Number{ > returnitem.CaServiceIds.getNumberAt(1) > } > I got the error > ArgumentError: Error #1063: Argument count mismatch on view::RadioStations/getLabelUnit2(). Expected 1, got 2. > Michelle.. > > ----- Original Message ---- > From: Tim Hoff <[EMAIL PROTECTED]> > To: [email protected] > Sent: Tuesday, August 12, 2008 8:17:39 PM > Subject: [flexcoders] Re: datagridcolumn > > > Hi Michelle, > You're on the right track with the labelFunction. Give this a try: > privatefunctiongetLabelUnit1( item:Object, column:DataGridColu mn) : Number > { > returnitem.CaServiceIds. getItemAt( 0); > } > privatefunctiongetLabelUnit2( item:Object, column:DataGridColu mn) : Number > { > returnitem.CaServiceIds. getItemAt( 1); > } > <mx:columns> > <mx:DataGridColumn headerText="Content Name" dataField="ContentName" width="64" wordWrap="true"/> > <mx:DataGridColumn headerText="Sellable Unit1" labelFunction= "getLabelUnit1" width="63" wordWrap="true"/> > <mx:DataGridColumn headerText="Sellable Unit2" labelFunction= "getLabelUnit2" width="63" wordWrap="true"/> > </mx:columns> > -TH > > --- In [EMAIL PROTECTED] ups.com, Michelle Davis <mtndavis@> wrote: > > > > Hello, > > > > I have the following issue and I don't know what to do. > > > > My DatagGrid dataProvider is ArrayCollection contains the following information > > > > _1363246720dgCaAsso ciation = mx.controls. DataGrid (@34090a1) > > mx.controls. dataGridClasses. DataGridBase [inherited] = > > columnCount = 3 : Number > > columns = Array (@317af59) > > dataProvider = webservices. caconfigurator. CaAssociationArr ay (@3413601) > > mx.collections. ArrayCollection [inherited] = > > [0] = webservices. caconfigurator. CaAssociation (@33f3e51) > > CaServiceIds = webservices. caconfigurator. CaServiceIdArray (@3413501) > > mx.collections. ArrayCollection [inherited] = > > [0] = 242 [0xf2] : Number > > [1] = 243 [0xf3] : Number > > ContentName = "cu2" : String > > Id = 1 : Number > > RadioStationName = "knx" : String > > > > > > > > I called DataGridColumn to display ContentName on the first column, CaServiceIds[ 0] on the second column and CaServiceIds[ 1]on the third column. But not successful. Please help > > > > I tried the following: > > > > 1) I used "dataField" in all 3 DataGridColumn. The first column displayed "cu2", second column display "242,243" and third column display "242,243" > > > > <mx:columns> > > <mx:DataGridColumn headerText=" Content Name" dataField="ContentN ame" width="64" wordWrap="true" /> > > <mx:DataGridColumn headerText=" Sellable Unit1" dataField="CaServic eIds" width="63" wordWrap="true" /> > > <mx:DataGridColumn headerText=" Sellable Unit2" dataField="CaServic eIds" width="63" wordWrap="true" /> > > </mx:columns> > > > > > > > > > > > > 2) I used "labelFunction to display CaServiceIds[ 0] and CaServiceIds[ 1]. I got an error Main Thread (Suspended: Error: Unknown Property: 'null'.) > > mx.collections: :ListCollectionV iew/http: //www.adobe. com/2006/ actionscript/ flash/proxy: :getProperty > > view::RadioStations /getLabelUnit1 > > mx.controls. dataGridClasses: :DataGridColumn/ itemToLabel > > mx.controls. dataGridClasses: :DataGridBase/ makeListData > > mx.controls: :DataGrid/ http://www. adobe.com/ 2006/flex/ mx/internal: :setupRendererFr omData > > mx.controls: :DataGrid/ commitProperties > > mx.core::UIComponen t/validateProper ties > > mx.managers: :LayoutManager/ validateProperti es > > mx.managers: :LayoutManager/ doPhasedInstanti ation > > Function/http: //adobe.com/ AS3/2006/ builtin:: apply [no source] > > mx.core::UIComponen t/callLaterDispa tcher2 > > mx.core::UIComponen t/callLaterDispa tcher > > > > }privatefunctiondis playSellableUnit (ids:CaServiceId Array, index:Number) :Number{returnid s.getNumberAt( index)privatefun ctiongetLabelUni t1(item:Object, column:DataGridColu mn): Number {sellableUnit 1 = displaySellableUnit (item.CaServiceI ds[column. dataField] ,0)varsellableUn it1:Number} returnsellableUn it1 > > <mx:columns> > > <mx:DataGridColumn headerText=" Content Name" dataField="ContentN ame" width="64" wordWrap="true" /> > > <mx:DataGridColumn headerText=" Sellable Unit1" labelFunction= "getLabelUnit1" width="63" wordWrap="true" /> > > <mx:DataGridColumn headerText=" Sellable Unit2" labelFunction= "getLabelUnit2" width="63" wordWrap="true" /> > > </mx:columns> > > > > Thanks so much, > > Michelle - beginner on Flex builder 3 > > >

