on 2022 Feb 08 2:28 PM
Is it possible to enable edit mode for only particular properties on an Smarttable which is served by a CAP (via the cds-odata-v2-adapter-proxy).
I am able to bind the SmartTable and show the rows and also the edit button works, but it enables all properties.
I tried various annotations but still all fields are enabled for edit.
annotate TestEndpoint.Participants {
lastName @sap.updatable:false ;
lastName @Common.FieldControl: 1; //#ReadOnly;
firstName @sap.updatable:false @readonly;
lastName @sap.creatable:false ;
lastName @sap.label:'Last name Dummy' ;
ID @sap.updatable:false ;
}
The V2 Metadata Annotations look ok for me.
<EntityType Name="Participants"><Key><PropertyRef Name="ID"/></Key><Property Name="ID" Type="Edm.Guid" Nullable="false" sap:updatable="false"/><Property Name="lastName" Type="Edm.String" MaxLength="80" sap:updatable="false" sap:creatable="false" sap:label="Last name Dummy"/><Property Name="firstName" Type="Edm.String" MaxLength="80" sap:updatable="false"/><Property Name="score" Type="Edm.Int32"/></EntityType>
All Fields are editable after hitting the edit toggle, somehow it ignores the readonly definitions.

on the UI Side I followed the example from the UI5 Docs.
<smartTable:SmartTable editTogglable="true"
entitySet="Participants"
app:useSmartToggle="true"
showRowCount="true"
enableAutoBinding="true"
class="sapUiResponsiveContentPadding"
tableType="Table"
enableAutoColumnWidth="true">
</smartTable:SmartTable>
I created a dedicated Node CAP App which has that problem.
Request clarification before answering.
Hello,
You need to add app:useSmartField="true" attribute to your smart table and annotate the fields with @Common.FieldControl: #ReadOnly. It doesn't work without app:useSmartField="true" attribute.
Result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.