on 2024 Sep 21 5:46 PM
I want to modify/add the readonly property of some fields based on another table to make them editable/non-editable.
I tried with approaches like:
Request clarification before answering.
I think you should change your approach but the outcome you want is achievable.
Take a look at this documentation: https://sapui5.hana.ondemand.com/sdk/#/topic/f49a0f7eaafe444daf4cd62d48120ad0.html
You will be particularly interested in the @ui.Hidden and @Common.FieldControl annotations.
This fiori elements annotation shows how you could dynamically control the visibility of a field:
entity ProductsType : {
UI.FieldGroup #AdministrativeData : {
Data : [
{
$Type : 'UI.DataField',
Label : 'Modified at',
Value : ModifiedAt,
![@UI.Hidden] : HasDraftEntity,
},
],
},
}
You could easily replace 'HasDraftEntity' with a virtual field you calculate
Also checkout the SFLIGHT scenario as that makes fields readonly based off the status:
https://github.com/SAP-samples/cap-sflight/blob/main/app/travel_processor/field-control.cds
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matt,
Thanks for replying. Finally, I chose that approach. I declared virtual fields for each field and made the logic for them in a node.js event. I wonder if there is any better workaround for this, because its not very elegant as Im declaring a virtual field per normal field (I have a lot)...
User | Count |
---|---|
34 | |
22 | |
16 | |
8 | |
5 | |
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.