Related Item Column read only

Hi I have a desire to make a column in a related items table read only, I can do this on most columns by creating a "duplicate" calculated column and using that instead. However, in this instance it is for a multiple lines of text type, which we obviously cannot use in a calculated column. Is there a way to do this with JS at all? My form already has a large amount of formatting on the related items table so can see that this can be manipulated, but this only gets applied when it is not being edited.

At the same time, I am currently applying my formatting to about 50 tables, I am not a great programmer but have got it working as desired. The only issue is that it would be a lot easier to make changes if I was looping through all related items tables rather than having separate functions. I currently have one function for each table, which doesn't seem efficient!! The code I am using is below. Is there a way to loop through all SPDataTables and apply the same styling?

fd.control('SPDataTable1').ready().then(function(dt) {

var columns = $(dt.$el).find('col');

var value = dt.widget.dataItems();
var row = $(dt.$el).find('tr');
var projType = 'x';
var projType2 = 'y';
var projType3 = 'z';
var status = 'XY';

if(value){
    for (var i = 0; i < value.length; i++){
        if(value[i].ProjType == projType ) {
            //sets the background color of the row
            $(row[i+1]).attr("style","color:#EB5B00"); 
     
        }	
		            if(value[i].ProjType == projType2 ) {
            //sets the background color of the row
            $(row[i+1]).attr("style","color:#0546d8"); 
    
        }
		            if(value[i].ProjType == projType3 ) {
            //sets the background color of the row
            $(row[i+1]).attr("style","color:#c8a33a"); 
 
        }
		 if(value[i].Status !== status && value[i].Status !== 'In Progress' ) {
            //sets the background color of the row
            $(row[i+1]).attr("style","color:#B6AFAD"); 

        }					
    }	
}
$(fd.control("SPDataTable1").$el).find('.btn').hide();
fd.control("SPDataTable1").widget.hideColumn(7);
				$(row[1].cells[1]).attr("style","width:0.1%");
				$(row[1].cells[2]).attr("style","width:3.9%");
				$(row[1].cells[3]).attr("style","width:60%");  
				$(row[1].cells[4]).attr("style","width:6%");
				$(row[1].cells[5]).attr("style","width:10%");
				$(row[1].cells[6]).attr("style","width:20%");

});

Hello @Nathan,

You can change the look of List or Library control using the CSS, or you can run function for each List or Library control as in the example in this post.

Regarding disabling fields in List or Library control in inline editing mode, this feature currently is not available in SharePoint On-Premises, only in SharePoint Online.

Are you considering a paid support? We can migrate new features for SharePoint On-Premises immediately, as currently, we are planning to do this in 2 months. Please contact us via support@plumsail.com to know more details.

1 Like

Thanks @mnikitina,

The for loop works perfectly, that makes it a bit easier to amend the code in the future.

We purchased a new license with maintenance a few weeks ago, does that qualify as the support, if so i'll contact the support email address.

thanks,

Hello @Nathan,

Maintenance and paid support are different services.

Maintenance covers the support of the license, all new updates of the product released during the subscription year.

Paid support is a fee for helping with a configuration of the product or adding new functionality by request. In this case, for switching the priority of tasks: to migrate new features for SharePoint On-Premises immediately.