Disable Right click option on table column ?

  • 1
  • Question
  • Updated 2 years ago
Hi 

I have a requirement to disable right click option from particular name column in table.
could you please any one help me to resolve this issue.

Thanks
Deleep
Photo of Deleep Manda

Deleep Manda

  • 246 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Deleep,

Can you give a little more explanation on what you mean by "right click option"? Do you mean how you can right click on a name and redirect to its detail page?

Thanks!
Amy
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Deleep,

Adding this snippet as an inline resource should do the trick. Just modify the table id and column name variables to fit your page.

var $ = skuid.$;

(function(skuid){
	
	$(document.body).one('pageload',function(){
		
		disableRightClick();
		
	});
})(skuid);

function disableRightClick(){
    
var tableId = "sk-1H6KAU-172"; //substitute your table id here
var columnName = 'Note Titles'; //substitute your column name here

columnToDisableRightClick = $('#'+tableId).find('th').has("span:contains('"+columnName+"')");

$(columnToDisableRightClick).bind('contextmenu', function(e){
    return false;
});


//source: http://stackoverflow.com/a/10864321/4188138
}
(Edited)