SAP UI5 version 1.108.20 propertyChange alternative

48 Views Asked by At

The class sap.ui.model.odata.v4.ODataModel in version 1.108.20 does not support the propertyChange event, according to the documentation .

enter image description here

However, the propertyChange event is supported up to version 1.110.0. Is there any other event that can be used to observe Two-Way Data Binding changes?

I have created a video to show you what I am trying to achieve. enter image description here

The value of the Field Description column depends on the Fieldname column. Therefore, whenever a new value is selected in the Fieldname column, it should display the corresponding Field Description. Currently, the change is only applied after the page has been refreshed.

According to the propertyChange event documentation for the newest version of UI5, it states:

The propertyChange event is fired whenever one of this model's property bindings successfully changes its value due to two-way data binding. This does not apply to sap.ui.model.odata.v4.Context#setProperty which represents controller code changes, not user input.

Unfortunately, the UI5 version 1.108.20 does not support the propertyChange event. Is there an alternative event that offers similar functionality?

The app is built with Fiori elements, therefore the controller needs to be extended to listen on the event.

2

There are 2 best solutions below

0
A.vH On

Have you tried using Side Effects?

0
softshipper On

The annotation @ObjectModel.text.element: ['DocumentTypeText'] in the ABAP CDS has solved the issue.

          @ObjectModel.text.element: ['DocumentTypeText'] 
          @Consumption.valueHelpDefinition: [{  entity: {   name: 'C_DocumentTypeVH' ,
                                                            element: 'DocumentType'  }     }]
  key     DocumentType,
          @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SENSITIVEFIELDITEM_VEC'
  virtual DocumentTypeText     : /opt/doctypetext,