I have a field named "Item number" inside my Issue tracking list, which is a system generated ID, and i do not want end users to be able to modify it . now i have set this column as "Hidden" inside the content type to hide it when Create or edit items.
But i am displaying it inside the "All Items" view, which caused a problem, because end users are be able to edit this system generated ID using the Quick Edit capability, as follow:-
so can anyone adivce how to prevent modifying a column using the quick edit capability ?,for example by disabling the related cells ??
EDIT:-
now when i access the site column from my "site setting >> site columns" i got the following URL :-
http://..../_layouts/15/fldedit.aspx?field=ID1&Source=%2F%5Flayouts%2F15%2Fmngfield%2Easpx%3FFilter%3DAll%2520Groups
as follow:-
which means the item id = ID1 is this correct ? based on this i wrote the following HideColumnsINGrid.js
script :-
(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 define the jslink insdie the column :-
$web = Get-SPWeb http://vstg01
$field = $web.Fields["Item Number"]
$field.JSLink = "Style%20Library/JS/HideColumnsINGrid.js"
$field.Update($true
)
the power-shell script worked well, but still i i can edit the item named "Item Number" from the quick edit . i have a feeling that the item id and name i specified is not correct