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%");
});