on 2018 Oct 29 4:18 PM
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!
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jocelyn,
Thanks for your quick response. Yesterday i tried to set the facet to hidden using the @UI.hidden annotation, but the annotation wasn't taken into account by the UI.
Today I tried it again, but using a higher UI5 version in my run configuration in WebIde. Now the facet was hidden 🙂 So the annotation UI.hidden on a facet doesn't get reflected in older UI versions (1.48 and lower).
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ui.hidden can be filled with a dynamic value as follows: @ui.hidden: #(<boolean_fieldname_in_cds>)
So a hashtag, open braket, fill in your field name that is dynamic (ie a virtual element, or just another field from your data-source...) close braket.
The field that is mentioned must, of course, be a boolean!
Hope this helps anyone looking for the concrete code to get this working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.