on 04-11-2019 9:06 AM
Hello,
We're trying to hide a DataField in Fiori Elements using @UI.Hidden in our local annotation file, but it still shows up in our app. We've tried refreshing the browser and also logged in using Incognito-mode, but to no avail.
We've added the following to the annotation.xml
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="attendees_number"/>
<Annotation Term="UI.Hidden" Bool="true"/>
</Record>
Regards
Mattias
We found the answer, we're on UI5 1.52, when running it on version 1.64 in the FLP sandbox it works, seems @UI.hidden is broken in 1.52.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mattias,
If that is the case, you can try doing from UI5 custom code as well in controller extension.
First get the entire model from your CDS and in object page, where you are showing the field group. Based on some flag, you can hide the field for certain data. In this case model will be same as coming from CDS or OData, but in UI layer you can hide it based on your condition. Hope I am understanding your requirement correctly.
Regards,
Tejas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For such logic you should handle in odata. Use SEGW project, create a CDS reference and modify the metadata based on the condition in your MPC or DPC class.
Moreover do you want to say that for certain condition the whole report will not show the data field ? In List report, either you can hide the column for entire data (as datafield is nothing but a column in responsive table). If you want to modify the field in row level, i think you can still play with the data but not the column.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's not a data field in a LineItem, it's a data field in a FieldGroup, basically we don't want to show the field "Number of Attendees" for certain types of activity. Currently we have a calculated field in the CDS that returns 'X' or '' depending on whether we should show the field or not
cast( case activity_data.process_type
when 'Z004' // Kundanpassat seminarium
then ''
else
'X'
end
as BOOLE_D) as hide_attendees_number,
We bind this field to @UI.hidden in the annotation.xml-file, but it is not working. Since it doesn't work if we set the field to false hard, as per my first example, but it works when we set it in the CDS, it seems the app is ignores our local annotation file.
If I'm not mistaken the MPC is only called once when opening the app, not when we load a new entity, so I don't think it would work to put the code in the MPC? Please correct me if I'm wrong.
Mattias Johansson Your scenario works with draft enabled solution, does your system support draft concept?
BR,
Mahesh
Hi, no, it does not, we're on Netweaver 7.50, so no drafts for us yet. But why would this be required to hide a field dynamically?
Anyway the problem isn't the calculated property, but even if we put the following in our Annotations file it is not hidden, only if we do it in the CDS
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="attendees_number"/>
<Annotation Term="UI.Hidden" Bool="true"/>
</Record>
Did you try removing the clone option, reclone Local annotation and try. Sometimes the changes are not reflected. Or for effective hiding, write the same in CDS, below @UI.lineitem
Regards,
Tejas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It works fine when adding
@UI.hidden: true
in the CDS. However we would like to hide the field dynamically based on some custom logic. We're not aware of any way of doing this in the CDS. We therefore created a new virtual attribute in the CDS, which we want to use in the annotations XML file to control the visibility of the field.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.