I have never worked with an AdvancedDataGrid, but for a regular DataGrid I 
would do the following:
- create a new component that will be the item-renderer (possibly extend 
DataGridItemRenderer)
- this new component would contain a popup-menu component
- at this component level you have access to the 'data' property of that item, 
which would hold any information, such as urls / links

At this point I'm not clear with what u are trying to do, but you have various 
events / options open to you. Such as ListEvent, where you can set up a 
listener on your DataGrid. For example, itemClick:

myDataGrid.addEventListener(ListEvent.ITEM_CLICK, onDataGridItemClick);

private function onDataGridItemClick(e:ListEvent):void {
trace(e.itemRenderer.data); // here you have a handle to either the component 
itself (e.itemRenderer), or the actual data
}

Cheers
Tracy

--- In [email protected], "thomas_13s" <thomas_...@...> wrote:
>
> Hi ,
> I have an advanced data grid , with 8 columns one of the columns i want the 8 
> th column as a POPUPMenu Button,  and when I click on the menu item it should 
> navigate to a url value which is in the Array dArr. Array ddArr has 2 values 
> ,how can i do this I have tried many things.
>  Array ddArr has the values [dd.label,dd.url] and some valuses in the array 
> has more than one occurence, I mean [dd.label1,dd.url1],[dd.label2,dd.url2]. 
> The values to be populated in the POPUPMenuButton , i have in an array 
> dArr.After doing this I see only the popupButton but no data from ddArr .
> please help me out.
> <?xml version="1.0"?>
> <!-- Dashboard Main Service Summary table --> 
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%" 
> height="100%" backgroundColor="#FFFFFF" 
>                 initialize="initApp();" 
> creationComplete="onCreationComplete();">
>   <mx:Style>
>     .hStyle { fontWeight:bold; fontFamily:Verdana; fontSize:12; align:center; 
> }
>   </mx:Style>
>   <mx:Script>
>     <![CDATA[
> 
>   var ddArr:ArrayCollection = new ArrayCollection();
> var dp:ArrayCollection = new ArrayCollection();
> 
>  var ddLabel:String="";
>           var ddUrl:String="";
>           var ddData:String="";
>           var ddRest:String="";
>           var popUpB:PopUpMenuButton;
>  
>  
>  
> ddData=  xd[9];
>               ddRest=ddData;
>               var ddidx:int = ddData.indexOf("|");  
>              // var  dObj:Object=new Object();    
>                while ( ddidx > 0 )
>                {
>                
>                    ddLabel= ddRest.substring( 0, ddidx ); 
>                   
>                    ddRest= ddRest.substring(ddidx + 1  );
>                     ddidx = ddRest.indexOf("|"); 
>                if(       ddidx > 0)
>                {
>               // ddUrl= ddRest.substring(ddidx + 1  );
>                 ddUrl= ddRest.substring(0, ddidx   );   
>               
>                  ddRest= ddRest.substring(ddidx + 1  );
>                      ddidx = ddRest.indexOf("|"); 
>                }
>                
>                   dObj.label=  ddLabel;
>                   dObj.url=    ddUrl;
>                  ddArr.addItem(dObj);
>                
>                }
>                popUpB=new PopUpMenuButton();
>                myMenu = new Menu();   
>                myMenu.labelField = "Action";
>                 myMenu.showRoot = true;
>                 myMenu.width = popUpB.width;
>                 myMenu.selectedIndex = 0; 
>                 myMenu.dataProvider =  ddArr;
>                      
>                // myMenu.addEventListener("itemClick", itemClickHandler);
>                
>                popUpB.popUp = myMenu;
>  
> dp.addItem( { "Index":xd[0], "Service":xd[1], "Priority":xd[2], "Current 
> SLA":xd[3],"Health":xd[4], "Quality":xd[5], 
>                           "Risk":xd[6], "Avail":xd[7], "OpMode":xd[8], 
> "dd":popUpB} );
>  dp = dpSrv;
>   gc.source=dp;   
>        gc.refresh();
> 
>  ]]>
> 
>  </mx:Script>
> 
> <mx:HTTPService id="sst" resultFormat="text" result="onJSONLoad(event)" 
> url="{sURL}" fault="onFaultLoad(event)"/> 
>   <mx:Panel title="{cTitle}" width="100%" height="100%" 
> titleStyleName="hStyle" headerColors="[0xC5DFF9,0xEFF6FF]" >
> 
> <mx:AdvancedDataGrid id="srvTable" width="100%" height="100%" 
> color="0x323232" dragEnabled="true" dropEnabled="true"
>  enabled="true" showHeaders="true"
> displayItemsExpanded="true" variableRowHeight="true" wordWrap="false" 
> initialize="gc.refresh();"  >
> <mx:dataProvider>
>               <mx:GroupingCollection id="gc" source ="{dpSrv}">
>                     <mx:grouping>
>                         <mx:Grouping>
>                           <!-- <mx:GroupingField name="PService" /> --> 
>                             <mx:GroupingField name="Service" /> 
>                         </mx:Grouping>
>                     </mx:grouping>
>                 </mx:GroupingCollection>  
>                <!-- <mx:HierarchicalData id="gc" source="{dpSrv}"/>   -->
>                 </mx:dataProvider>     
>             
>             <mx:columns>
> 
> <mx:AdvancedDataGridColumn id ="ddcol" dataField="dd"  headerText=" 
> Drill-down" width="200" textAlign="left">
>             
>                  </mx:AdvancedDataGridColumn>
>                              
>                </mx:columns>
>                
>        <mx:rendererProviders> 
>              <mx:AdvancedDataGridRendererProvider dataField="dd" depth="1" 
> column="{ddcol}"  columnIndex="8"
>              renderer="mx.controls.PopUpMenuButton" /> 
>           </mx:rendererProviders>  
>  </mx:AdvancedDataGrid>
>  </mx:Panel>
> </mx:Application>
> 
> thanks in advance, 
> Tom.
>


Reply via email to