Suppress ContextMenu on ADF Components

This entry is more for me to remember,as I’m sure I have read this somewhere before.
If someone has posted this before please drop a comment do that I can give credit to her/him.

Based on a question on OTN asking how to disable the normal browsers context menu, I advised to use a javascript method on the component and simply cancel the event.

As the questioner confirmed the idea works. So here is the solution:
1. Put  a af:clientListener on the component,  e. g.  an af:table, calling a javascript method nocontextmenu with activation type “contextMenu”

<af:clientListener method="nocontextmenu" type="contextMenu">

2. Implement the nocontextmenu() javascript method to cancel the browser context event as

function nocontextmenu(event) {

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s