0

I read the following link on how SharePoint 2013 supports disabling a site collection column inside the list's quick edit grid link. so I tried to apply the same inside a custom list. So I wrote the following JSLink :-

(function () { alert(fromhide); var overrideContext = {}; overrideContext.Templates = overrideContext.Templates || {}; overrideContext.Templates.OnPreRender = function(ctx) { var statusField = ctx.ListSchema.Field.filter(function(f) { return f.Name === 'Formate Number' }); if (statusField) { statusField[0].AllowGridEditing = false; } } SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext); })(); 

and then I associated the site column with the above js script using the following power shell command:-

$web = Get-SPWeb http://testsite $field = $web.Fields["Formate Number"] $field.JSLink = "/_layouts/15/testscript.js" $field.Update($true) 

now when I access the list view page source inside my browser I can see that the testscript.js is being rendered , but this will not prevent editing the 'Formate Number' inside the quick edit grid ???

I am confused on why this is not working in my case?

1 Answer 1

0

In the Article the Author is using the column's internal name:

f.Name === 'Request_x0020_Status'; 

I think if you use the internal name of the column

f.Name === 'Formate Number' 

which would be I am assuming 'Formate_x0020_Number' might solve the issue.

You can get the internal name for a column by browsing to the List Settings > Edit Column and look at the QueryString. This will be url encoded. You will get similar to the following:

/_layouts/FldEdit.aspx?List=%7B37920121%2D19B2%2D4C77%2G56EE%2D8B3E08724224%7D&Field=Formate%5Fx0020%5FNumber

%5F represents '_' and the field name is 'Formate_x0020_Number'.