Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Hidding table row - presence = "hidden" not working

Avatar

Level 2

Hi all,

 

I need to hide a row from the table based on a condition and all the suggestions I found says to use .presence = "hidden", but unfortunately only the line content is being hidden and not the entire row.

This is the JavaScript I'm using:

data.#pageSet[0].Page1.BasicData::initialize - (JavaScript, client)

if ( $record.V_FLAG.value != "X" ) {
this.resolveNode("Page1.BasicData.Table1.Line2").presence = "hidden";
}

 

I also tried the following alternatives:

 

if ( $record.V_FLAG.value != "X" ) {
this.resolveNode("Page1.BasicData.Table1.Line2.Cel1").presence = "hidden";
}

if ( $record.V_FLAG.value != "X" ) {
this.Table1.Line2.presence = "hidden";
}

if ( $record.V_FLAG.value != "X" ) {
this.Table1.Line2.Cel1.presence = "hidden";
}

 

I appreciate any help.

1 Accepted Solution

Avatar

Correct answer by
Employee

@Magus069fair enough but from the description and the word "table" you cannot pinpoint things as everyone uses terms in their way.

If this is a XFA table it should be totally easy:

Kosta_Prokopiu1_0-1616396295303.pngKosta_Prokopiu1_1-1616396329566.png

You don't even need all that flowed context stuff as long as the table stands on its own, has nothing following it which needs to move and does not exceed the page boundaries.

 

If that does not work for you then I can only guess what the problem may be:

  • Something different in the structure of your XFA table compared to mine.
  • Is this a dynamic table, meaning Line2 is repeated vs. fixed row design?
  • Your logic is somehow not correct or not correctly placed
  • Your data is not what you expect.
  • Ideally you should place the hiding logic in the Line2 table subform if possible. Saves you the resolveNode.
    if ( $record.V_FLAG.value != "X" ) {
      this.presence = "hidden";
    }

View solution in original post

11 Replies

Avatar

Level 10

Hi there,

 

it is hard to say why it behaves this way, and without the hierarchy it would be hard to explain and understand... have you tried hiding Table1?

I am not sure exactly what you mean by: hiding Line1 is hiding the content only and not the row.

Avatar

Employee

my guess: you have not placed your table in a flowed top-to-bottom context. In that case hidden would hide things but they cannot flow/collapse.

Kosta_Prokopiu1_0-1616174826157.png

I created a table and make Line1 hidden on initialize

Kosta_Prokopiu1_3-1616175229959.png

When Table1 is not Flowed then the wrong result:

Kosta_Prokopiu1_4-1616175279384.png

 

Result with Table1 Flowed:

Kosta_Prokopiu1_5-1616175319257.png

 

 

Avatar

Level 2
I was trying to use the table element, but using subforms worked too.

Avatar

Level 2
I was trying to use the table element, but using subforms worked. Thank you

Avatar

Level 2
I was trying to use the table object, but using subforms worked. Thank you!

Avatar

Level 10
To be honest, his example is not fixing your error, but simply showing how it works with subforms... Your problem using a Table and Rows, is entirely different from simply changing the parent's subform to Flowed content.

Avatar

Correct answer by
Employee

@Magus069fair enough but from the description and the word "table" you cannot pinpoint things as everyone uses terms in their way.

If this is a XFA table it should be totally easy:

Kosta_Prokopiu1_0-1616396295303.pngKosta_Prokopiu1_1-1616396329566.png

You don't even need all that flowed context stuff as long as the table stands on its own, has nothing following it which needs to move and does not exceed the page boundaries.

 

If that does not work for you then I can only guess what the problem may be:

  • Something different in the structure of your XFA table compared to mine.
  • Is this a dynamic table, meaning Line2 is repeated vs. fixed row design?
  • Your logic is somehow not correct or not correctly placed
  • Your data is not what you expect.
  • Ideally you should place the hiding logic in the Line2 table subform if possible. Saves you the resolveNode.
    if ( $record.V_FLAG.value != "X" ) {
      this.presence = "hidden";
    }

Avatar

Level 2

@Kosta_Prokopiu1

 

I tried to follow your example, but it didn't work for me. The element is not collapsing.

 

robson1976_0-1616412779949.png

 

Before this.presence = "hidden"

robson1976_2-1616413408101.png

 

After

robson1976_3-1616413518779.png