How do I hide the "Datasheet view" option (under "View Format") in a list's ribbon menu?
6 Answers
As described in this article : Remove button from the Ribbon in SharePoint 2010, you can, with a feature, remove existing button.
In your case, the feature.xml file should be :
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="RemoveDataSheetButton"
Location="CommandUI.Ribbon"
RegistrationType="List"
RegistrationId="101">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.List.ViewFormat.Datasheet" />
</CommandUIDefinitions>
</CommandUIExtension>
</CustomAction>
</Elements>
-
Aha! Changing the 'Library' in the Location to 'List' allows it to work for lists (with the appropriate RegistrationId). Thanks for your help. I'll award the bounty once the 24 hours have passed.– Stu PeggCommented Jul 19, 2011 at 13:25
-
-
2Word of warning to others using this: it seems to only be compatible with 2010.– Stu PeggCommented Jul 22, 2011 at 10:19
In addition to Steve B's solution, another 2010-only way of doing this is to set the following property to true
:
Unfortunately there appears to be no way to do this in 2007.
You could use javascript to do this.
var menuItems = document.getElementsByTagName('ie:menuitem');
for (i=0; i<menuItems.length; i++)
if (menuItems[i].text == 'Edit in Datasheet')
menuItems[i].removeNode();
jQuery version:
$("ie\\:menuitem[text='Edit in Datasheet']").each(function() {
this.hidden = true;
});
Q: Have you tried simply unchecking the "Allow items in this document library to be edited using the datasheet?" to NO
-
I believe that's the front-end counterpart to
SPList.DisableGridEditing
, and hence also 2010-specific.– Stu PeggCommented Oct 4, 2012 at 14:47
Just got to List 'Advance settings' and there is an option that allows you to disable Datasheet view. Just say 'NO' to disable datasheet view.
Go to List settings for the page you want to edit - under general settings find Advanced settings - There should be a datasheet edit (yes 0r No)