Thanks Man..
this is what I needed..
Now I can execute some logic before showing Context munu..

I appreciate your help.

- Dharmendra



--- In [email protected], "valdhor" <valdhorli...@...> wrote:
>
> This example should help...
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="vertical" verticalAlign="middle"
>     creationComplete="onCreationComplete()">
>      <mx:Script>
>          <![CDATA[
>              import mx.controls.Alert;
> 
>              [Bindable] private var myContextMenu:ContextMenu;
>              private var approvedMenuItem:ContextMenuItem = new
> ContextMenuItem("Approved", false, false);
>              private var approveMenuItem:ContextMenuItem = new
> ContextMenuItem("Approve");
>              private var lastRollOverIndex:int;
> 
>              [Bindable] private var dp:Array = [
>              { symbol: "ADBE", name: "Adobe Systems Inc.", price: 49.95
> },
>              { symbol: "BETA", name: "Beta Inc.", price: 19.95 },
>              { symbol: "CSCO", name: "Cisco Inc.", price: 45.95 },
>              { symbol: "DELL", name: "Dell Inc.", price: 34.95 },
>              { symbol: "IBM", name: "IBM Corp.", price: 42.55 }
>              ];
> 
>              private function onCreationComplete():void
>              {
>                 
> approveMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
> menuItemHandler);
>                  myContextMenu = new ContextMenu();
>                  myContextMenu.hideBuiltInItems();
>                 
> myContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT,
> menuSelectHandler);
>              }
> 
>              private function
> menuSelectHandler(event:ContextMenuEvent):void
>              {
>                  dataGrid.selectedIndex = lastRollOverIndex;
>                  var currentItem:Object = dataGrid.selectedItem;
>                  if(currentItem.name == "Cisco Inc.")
>                  {
>                      myContextMenu.customItems = [approvedMenuItem];
>                  }
>                  else
>                  {
>                      myContextMenu.customItems = [approveMenuItem];
>                  }
>              }
> 
>              private function
> menuItemHandler(event:ContextMenuEvent):void
>              {
>                  var currentItem:Object = dataGrid.selectedItem;
>                  Alert.show(currentItem.name);
>              }
>          ]]>
>      </mx:Script>
>      <mx:DataGrid id="dataGrid" width="400" dataProvider="{dp}"
> contextMenu="{myContextMenu}"
>          itemRollOver="lastRollOverIndex = event.rowIndex">
>          <mx:columns>
>              <mx:DataGridColumn headerText="Name" dataField="name" />
>              <mx:DataGridColumn headerText="Symbol" dataField="symbol"/>
>              <mx:DataGridColumn headerText="Price" dataField="price" />
>          </mx:columns>
>      </mx:DataGrid>
> </mx:Application>
> 
> 
> HTH
> 
> 
> 
> Steve
> 
> 
> --- In [email protected], "Dharmendra Chauhan"
> <chauhan_icse@> wrote:
> >
> > Hi Everybody,
> >           I need to enable/Disable Context Menu Item based the
> selected row of the DG.ie I would perform some logic based on current
> selected row to decide enabling/Disabling of context menu item.
> >
> > Classical example of this is Timesheet application.
> > If a manager click on any of the entry which was already approved , he
> should NOT be getting approve option enabled.
> > I found some workaound to get this functionality workinng but they are
> all browser based.They do not apply in my case as my application is
> running on Flash Player.
> >
>


Reply via email to