Page 1 of 1

Related Item: Change Value in Displayform with JS

Posted: 07 Aug 2020
by slashmaster
Hi,

i want to change only the displayed Information of Related-Items. I looping the related item and check the Value from columns. If the value (for example) is "fin" i want to changed the display information to "finished". I dont want to update the Column in the list, only the view in displayform.

my Code:

Code: Select all

var Row = fd.relatedItems(0).data('ctx').ListData.Row;
$.each(Row, function(i, el) {
if(el.Info == "fin") {
// HERE'S the Code i needed.. this doesnt work.
fd.relatedItems(0).data('ctx').ListData.Row[i].Info = "finished";
}
}
thanks in advanced

kind regards

Re: Related Item: Change Value in Displayform with JS

Posted: 11 Aug 2020
by mnikitina
Hello slashmaster,

You need to add a CSS class to your Related Items, i.e. "related-issues' and add this code to your JavaScript Editor.

Code: Select all

var row = $(".related-issues").find("[role=row]");
for(var i = 1; i < row.length; i++) {
   //3 is the index of the column
    var cell = $(row[i]).find("td")[3];
    $(cell).html('New text')
}

Re: Related Item: Change Value in Displayform with JS

Posted: 12 Aug 2020
by slashmaster
Thank u very much mnikitina.