Related Item: Change Value in Displayform with JS

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
slashmaster
Posts: 29
Joined: Fri May 25, 2018

07 Aug 2020

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

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

11 Aug 2020

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')
}

slashmaster
Posts: 29
Joined: Fri May 25, 2018

12 Aug 2020

Thank u very much mnikitina.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests