http://blog.flexexamples.com/2007/08/20/using-a-custom-context-menu-with-the-flex-datagrid-control/

On Wed, Mar 2, 2011 at 09:56, madhavi chinni <[email protected]>wrote:

> Hi,
>
> I am add customItems in the ContextMenu.I have a function which
> creates Grid dynamically.I am setting the ContextMenu object to that
> GridItem.I am calling these two functions(ContextMenu
> creation,creation of the Grid) when application creation is complete.
>
> When I right click on the GridItem I am unable to see the CustomItems
> in the ContextMenu.
> But when I find the length of the CustomItems in the contextMenu of
> the GridItem it is giving me the correct length.
>
> Did anyone of you face this problem before?
>
> Please find the code snipplet below:
>
> private function init():void{
>                                var showSelection:ContextMenuItem = new
> ContextMenuItem("Show
> selection");
>
>  showSelection.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
> showSelection_menuItemSelect);
>
>                                var upperCase:ContextMenuItem = new
> ContextMenuItem("Convert to
> upper case");
>
>  upperCase.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
> upperCase_menuItemSelect);
>
>                                var lowerCase:ContextMenuItem = new
> ContextMenuItem("Convert to
> lower case");
>
>  lowerCase.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
> lowerCase_menuItemSelect);
>
>                                cm = new ContextMenu();
>                                cm.hideBuiltInItems();
>                                cm.customItems.push(showSelection);
>                                cm.customItems.push(upperCase);
>                                cm.customItems.push(lowerCase);
>
>
>
>                        }
> code for assigning contextMenu to GridItem:     grid_item.contextMenu=cm;
>
> code for when I am printing the length of the ContextMenu when I click
> on the GridItem:
> public function ClickHandler(event:MouseEvent):void
>                        {
>
> Alert.show(""+event.currentTarget.contextMenu.customItems.length);
>
>
>
>                        }
>
> Any help is greatly appreciated.
>
> Thanks,
> Madhavi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>


-- 
Fear is an illusion, So, face it !
RM3sh

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to