John
Q: First you need to dig deeper into the field definition using SharePoint Manager 2013, and observe if property 'AllowGridEditing' exists?
A: The property doesn't exist so give PowerShell a break ;)
Why: In SharePoint 2013, client-side rendering (CSR) provides a way to control the output/design of your fields and set of controls by leveraging HTML and JavaScript technologies for example how should the fields render in list views (edit, new or quick edit), search, list forms etc. AllowGridEditing
can easily be manipulated CSR technique. I have done a small variation using CSR below.
Now, every field definition comes with JSLink
property that can be overridden, by providing your own JS file, which means your own rendering of that field.
Following PowerShell will set up the JSLink property with my own rendering of that field, which eventually hide the field in QuickEdit mode.
PowerShell:
$web = Get-SPWeb "https://yoursite/"
$list = $web.Lists["Meeting"]
$field = $list.Fields["Item Number"]
$field.ShowInNewForm = $False
$field.ShowInEditForm = $False
$field.JSLink = "/_layouts/15/falak/HideQuickEdit.js"
$field.Update();
Here is content of HideQuickEdit.js
file, which I have placed under 15 hive. Forgive me for doing it in a quick n dirty way, but you gotta a clean up job to do, like moving JS file to appropriate place, set up the JSLink property in field definitions etc.
P.S. Make sure you have reference to jQuery library in master page.
function CustomOverrides() {
var obj = {};
obj.Templates = {};
obj.OnPostRender = HideQuickEditValues;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(obj);
}
function HideQuickEditValues(ctx) {
// hide rendering when in quick edit mode
if (ctx.inGridMode) {
var cell = $("div [name='Item Number']").closest('th');
var cellIndex = cell[0].cellIndex + 1;
$('td:nth-child(' + cellIndex + ')').hide();
$('th:nth-child(' + cellIndex + ')').hide();
}
}
CustomOverrides();
Happy SharePointing.