Skip to Content

Help to hide subform if its table is empty. Using Javascript.

I have the following structure:

[http://i47.tinypic.com/2q88vuw.jpg|http://i47.tinypic.com/2q88vuw.jpg]

I tried everything I could think of to hide the subform but without success.

Can anyone help me with some javascript code that would work?

Thanks,

Paul

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 02, 2010 at 02:02 AM

    Hi Paul,

    I assumed there is a main subform to contain FREIGHT subform, OTHERCHARGES subform, and etc.

    Lets name the main subform as MAIN.

    Please change the MAIN subform to have Flowed type, so each when FREIGHT is being hided, the subsequent subform can flow upwards instead of leaving a blank.

    Object -> Subform -> Content = "Flowed".

    code to hide the subform

    xfa.form.data.MAIN.FERIGHT.presence = "hidden"; 

    Hope this helps.

    regards,

    Xiang Li

    Add comment
    10|10000 characters needed characters exceeded

    • I got it working by creating a global variable: FREIGHT_EXISTS or type BOOLEAN.

      Code initialization checks, with abap code, if the freight table is empty and assigns the appropriate value to the above variable.

      In the initialization part of the Freight subform that I want to hide I just put the simple code:

      if (this.FREIGHT_EXISTS.rawValue = "-" ) { this.presence = "hidden"; }

      Thanks to all who answered.