on 11-11-2021 7:08 AM
Hello,
I'm searching for a way in SAP CAP (NodeJS) to change the editability of UI controls during runtime.
So 2 use cases.
1. based on a role (e.g. admin)
2. based on business logic (e.g. if a checkbox is marked another field gets readonly)
Think I for case one I can use @restrict annotation. Not sure how the UI behaves (readonly or invisible). Will try is asap. --> Result was that using
@restrict: [{grant:'*', to: 'admin'}]
requestor : User;
has no effect on the UI. Think this is not supported on field level.
But for case two I did not find a solution yet. Somebody an idea?
As we had problems to implement this in the "on after handler" in nodeJS we thought that maybe a local annotation of the odata service could help.
So we implemented that ... an with a location annotation it is working !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found a solution ... See
https://sap.github.io/odata-vocabularies/vocabularies/Common.html
FieldControlType
in combination with a virtual field of type Integer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
solved it wit local annotations...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anything that you can share / write a blog post about it?
So my suggested solution does not work if the fields, the calculation is based on, are located on another tab.
Here an example:
I want to set Name and Version input fields on first tab to readonly if a field/checkbox which is locatedon 3rd tab is set true (is checked).
So I implemented
this.after("READ", "Applications", async (data, req) => {<br>
...
}
The problem is now that in this after event only the visible fields on tab 1 are present in "data" and not the one's from 3rd tab.
Any way to have
FieldControlDynamicIf
like described here https://sapui5.hana.ondemand.com/sdk/#/topic/0e7b890677c240b8ba65f8e8d417c048
Or can I enforce to load all data in one call (for all tabs)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.