Expand my Community achievements bar.

SOLVED

How to hide dynamic table row according to a field

Avatar

Level 1

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?.

1 Accepted Solution

Avatar

Correct answer by
Level 1

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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 1

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

Avatar

Level 10

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";