views:

299

answers:

1
    var contextMenu:ContextMenu = new ContextMenu();

        contextMenu.hideBuiltInItems();

        var contactList : ContextMenuItem = new ContextMenuItem("Add to Existing List");
        contactList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doStaticListCommand);

        var newContactList : ContextMenuItem = new ContextMenuItem("Add a New List");
        newContactList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doNewStaticListCommand); 

        var removeContactList : ContextMenuItem = new ContextMenuItem("Remove contact from List");
        removeContactList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doRemoveListCommand);

        var deletecontact:ContextMenuItem = new ContextMenuItem("Delete contact");
        deletecontact.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, dodeleteconactCommand);

        var TimeList : ContextMenuItem = new ContextMenuItem("Add Time Spent");
        TimeList.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, doTimeListCommand);

        contextMenu.customItems.push(contactList);      

        contextMenu.customItems.push(newContactList);           

        contextMenu.customItems.push(deletecontact);

         contextMenu.customItems.push(removeContactList);

In flex i done contex menu , if i rigt click then show context menu item but i want to hidden particular context menu item in list , is it possiable hidden and show particular items in context menu ? please refer me , i tried key value based

if(Application.application.contact_key==1)
{
        contextMenu.customItems.push(deletecontact);
    }
        else 
    {

          contextMenu.customItems.push(removeContactList);
    }

        contextMenu.customItems.push(TimeList); 

        return contextMenu;

Within itemRenderer

All coding on contactListItemRenderer.as and call to datagrid like

 <mx:DataGridColumn  itemRenderer="com.view.Contact.ContactListItemRenderer"
                         dataField="fullName" headerText="Full Name" />
A: 

You can access the custom menu items by contextMenu.customItem and hide/show any particular item. For the build in menu items you can access contextMenu.builtInItems (see the code below):

        contextMenuCustom.builtInItems.zoom = false;
        contextMenuCustom.builtInItems.save = true;
Cornel Creanga
it's not working Cornel Creanga
R.Vijayakumar
Thank you for your response me Mr.Cornel Creanga
R.Vijayakumar