Related-item Readonly
Hello,
Can I set readonly this related-items' column according to group permission?
Thanks.
Can I set readonly this related-items' column according to group permission?
Code: Select all
IsCurrentUserMemberOfGroup("Test Users", function (isCurrentUserInGroup) {
if(!isCurrentUserInGroup)
{
... // set readonly
}
});
}
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Sertkaya,
We do not offer such functionality out of box, there should be solutions to this question as Related Items uses SharePoint's default List view. You can check out this thread for an example of possible solution - https://sharepoint.stackexchange.com/qu ... n-gridview
We do not offer such functionality out of box, there should be solutions to this question as Related Items uses SharePoint's default List view. You can check out this thread for an example of possible solution - https://sharepoint.stackexchange.com/qu ... n-gridview
Cheers
I think this code should work but not

Code: Select all
$('tr>td[role="gridcell"]:nth-child(3)').attr("aria-readonly","true");
Hello!
Please do the following:
1. create the .txt file and paste the code below in it. Make sure to enclose it in <Script> tags. Save the file to Sharepoint Document library on your site. Replace {Colum_to_hide} with your field's internal name;
2. add the Content Editor web part to the view page. Edit web part and paste the link to the .txt file in Content link;
3. in the Web Part Advanced setting specify the group you want to hide the field from in Target Audiences. Click OK and test it.
Please let me know how that worked out for you.
Please do the following:
1. create the .txt file and paste the code below in it. Make sure to enclose it in <Script> tags. Save the file to Sharepoint Document library on your site. Replace {Colum_to_hide} with your field's internal name;
2. add the Content Editor web part to the view page. Edit web part and paste the link to the .txt file in Content link;
3. in the Web Part Advanced setting specify the group you want to hide the field from in Target Audiences. Click OK and test it.
Code: Select all
<script>
var updateViewerFields=["{Colum_to_hide}"];
(function updateView() {
var overrideContext = {};
overrideContext.Templates = overrideContext.Templates || {};
overrideContext.Templates.OnPreRender = function(ctx) {
for(j=0; j<ctx.ListSchema.Field.length; j++)
{
var f = ctx.ListSchema.Field[j];
for(i=0;i<updateViewerFields.length;i++){
if(f.DisplayName == updateViewerFields[i]){
f.AllowGridEditing=false;
}
}
}
}
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();
</script>
Hello,mnikitina wrote: ↑11 Jul 2019Hello!
Please do the following:
1. create the .txt file and paste the code below in it. Make sure to enclose it in <Script> tags. Save the file to Sharepoint Document library on your site. Replace {Colum_to_hide} with your field's internal name;
2. add the Content Editor web part to the view page. Edit web part and paste the link to the .txt file in Content link;
3. in the Web Part Advanced setting specify the group you want to hide the field from in Target Audiences. Click OK and test it.
Please let me know how that worked out for you.Code: Select all
<script> var updateViewerFields=["{Colum_to_hide}"]; (function updateView() { var overrideContext = {}; overrideContext.Templates = overrideContext.Templates || {}; overrideContext.Templates.OnPreRender = function(ctx) { for(j=0; j<ctx.ListSchema.Field.length; j++) { var f = ctx.ListSchema.Field[j]; for(i=0;i<updateViewerFields.length;i++){ if(f.DisplayName == updateViewerFields[i]){ f.AllowGridEditing=false; } } } } SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext); })(); </script>
Thanks for your help. Unfortunately not working

-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests