How to hide dynamic table row according to a field

KareemGaber

09-02-2020

I'm trying to hide rows according to value of text but it only works on the first row.

MaterialInspection.layout.Table1.Row1.InspectionResult.rawValue = MaterialInspection.layout.Table1.Row1.Print.rawValue;

if(MaterialInspection.layout.Table1.Row1.Print.rawValue == "false") 
{ 
this.presence = "hidden"; 
} 
else if(MaterialInspection.layout.Table1.Row1.Print.rawValue == "true") 
{ 
this.presence = "visible"; 
}

I tried the above code in initialize events of each of Table1 and Row1, I also tried it in index change event of Row1, if the value of the first row is false all the rows gets hidden and if the value of the first row is true then all the rows gets visible, what am I doing wrong?.

Accepted Solutions (1)

Accepted Solutions (1)

KareemGaber

09-02-2020

I managed to do it in the index change event like that:

this.InspectionResult.rawValue = this.Print.rawValue;

if(this.Print.rawValue == "false") 
{ 
this.presence = "hidden"; 
} 
else if(this.Print.rawValue == "true") 
{ 
this.presence = "visible"; 
}

Answers (1)

Answers (1)

radzmar

MVP

11-02-2020

In case the value of the field can be changed by a script or user action, your solution won't work, since it fires just once per row, when it's going to be created the first time. To make it work use the following script in the calculate event of the row. 

 

this.presence ? Print.rawValue === true ? "visible" : "hidden";