I have a custom site column named "Item Number". now i want to force this column to be un-editable inside the Quick Edit grid. now when i try to edit the site column (Site Setting>> Site Column >>click on the column), the url will be as follow:-
http://..../_layouts/15/fldedit.aspx?field=ID1&Source=%2F%5Flayouts%2F15%2Fmngfield%2Easpx%3FFilter%3DAll%2520Groups
which mean the field ID = ID1. so to be able to hide the column from all the Quick edit grid , i wrote the following JSLINK script (HideColumnsINGrid.js):-
(function () {
var overrideContext = {};
overrideContext.Templates = overrideContext.Templates || {};
overrideContext.Templates.OnPreRender = function(ctx) {
var statusField = ctx.ListSchema.Field.filter(function(f) {
return f.ID === 'ID1';
});
if (statusField) {
statusField[0].AllowGridEditing = false;
}
}
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();
then i wrote the following powershell script to apply the above JSlink to the field as follow:-
$web = Get-SPWeb http://vstg01
$field = $web.Fields["Item Number"]
$field.JSLink = "Style%20Library/JS/HideColumnsINGrid.js"
$field.Update($true
)
now the power shell script did not raise any error , but the Item number can still be edited from the Qucik Edit ?so can anyone adivce on this please ?
Thanks