Skip to Content

Hide Facet conditionally in fiori elemetns

Hello,


Does somebody know, it's possible to hide a UI Facet (in my case a reference facet to a table) conditionally?

In some circumstances I need to hide a reference facet of a table of a child element.

Thanks in advance!

Add a comment
10|10000 characters needed characters exceeded

  • Hi Mattijs,

    can you please tell me what did you provide in the value for UI.hidden? I have a very similar requirement. I want to hide a section during creation mode alone. I would prefer to do it in metadata extension of CDS.

    Regards,

    Lavanya

Related questions

4 Answers

  • Best Answer
    Posted on Oct 30, 2018 at 06:02 AM

    Hi Mattjs

    It certainly must be possible because that's one of the things we do with UI Adaptation at runtime!

    What you want to think about is perhaps @UI.hidden and providing a value for true/false dynamically. That's easy to do if you are providing the value via a metadata extension to a CDS view.. i.e. use a virtual attribute of the CDS view to calculate your true/false boolean and pass that as the value of @UI.hidden

    Rgds

    Jocelyn

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 01, 2018 at 11:15 PM

    Good tip! Mattjs. If you are interested in sharing your experiences, it would make a good blog that we could add to the Fiori elements wiki https://wiki.scn.sap.com/wiki/display/Fiori/Fiori+elements

    I'd be happy to add it in if you can do a short blog on this?

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Jocelyn,

      I have same requirement, to hide the facet dynamically. I have tried with using virtual attribute in metadata extension and in consumption cds view.

      But Its not working.

      Please could you share the step and simple code. Then It would be very helpful.

      Thanks in advanced!

      Regards,

      Dhiraj

  • Posted on Jan 16, 2019 at 11:28 AM

    Hi Mattijs,

    can you please tell me what did you provide in the value for UI.hidden? I have a very similar requirement. I want to hide a section during creation mode alone. I would prefer to do it in metadata extension of CDS.

    Regards,

    Lavanya

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Lavanya,

      I added annotations using the annotation modeler as the version of our backend system doesn't support ui.facet annotation in cds view.

      In our case the value of hidden was bound to an attribute of the entity.

      In our UI5 version, the value false set the facet to hidden and viceversa.

      annotations.jpg (45.8 kB)
  • Posted on Jul 24, 2020 at 11:31 AM

    Hey everyone,

    Unfortunately, I was not able to implement the metadata extension, because I was working on an extend view and the original view doesn't allow metadata extensions.

    But a code based alternative approach is possible. You can find it in this blog.

    Cheers,

    George

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.