Closed slavik-lvovsky closed 4 months ago
Hello,
It seems the issue is in "isModelPropertyChanged" method.
I modified your snippix to #450486
oModel.attachPropertyChange(oEvent => {
oModel.setProperty("/checkbox/enabled", oModel.getProperty("/authGrant/selectedKey") === 'AuthGrant 1');
});
and it is working correctly.
Best, Teodor
Hi @TeodorTaushanov,
I understand what you did in the #450486, but your logic just hides the bug. You can put a breakpoint in the oModel.attachPropertyChange(oEvent you have created and see that no event comes from changing the "/authGrant/selectedKey" property. All events come only from changing the "/purpose/selectedKey" property.
Please reopen the issue and investigate it.
Regards, Slavik.
I've created an internal incident DINC0097996. The status of the issue will be updated here in GitHub.
Regards, Teodor
From the issue description:
When "/authGrant/selectedKey" is changed by either oModel.setProperty ...
According to the description of the propertyChange
event:
Currently the event is only fired with reason
sap.ui.model.ChangeReason.Binding
which is fired when two way changes occur to a value of a property binding.
A two way change occurs when the value change is triggered from the UI. I.e. a change via the Model#setProperty
(one way) won't fire the propertyChange
event. It works as expected.
Duplicate of https://github.com/SAP/openui5/issues/2430
Hi @boghyon , @TeodorTaushanov , @i556484 ,
Thank you for investigating the issue. Does it mean that for now, the only solution for me is to use the sap.mSelect (AuthGrant) control's setSelectedKey method instead of the oModel.setProperty method?
Regards, Slavik.
OpenUI5 version: 1.108.26
Browser/version (+device/version): any browser
Snippet: #804290
Steps to reproduce the problem:
What is the expected result?
The "Purpose" model event handler for "/purpose/selectedKey" sets a new value for the "AuthGrant" model at "/authGrant/selectedKey". This action, in turn, triggers a model event that reaches the event handler for "/authGrant/selectedKey", resulting in a change to the "/checkbox/enabled" property.
What happens instead?
When "/authGrant/selectedKey" is changed by either oModel.setProperty("/authGrant/selectedKey", sNewAuthGrantSelectedKey); line 61 or oModel.setProperty("/authGrant/selectedKey", sNewAuthGrantSelectedKey, undefined, true); line 62 the event does not reach the "/authGrant/selectedKey" handler.
The event only triggers when "/authGrant/selectedKey" is changed by directly using the AuthGrant select control. lines 63-64
It seems that when a model event change handler triggers another model property change, the second event does not propagate and disappears.