简体   繁体   中英

SAPUI5 Data Binding get the value changed in change event

I am changing a model on websocket messages. I attached a change event function to it:

oBindingModel.attachChange(function(oEvent){}

Now, inside the function, I need to know which value has changed. I searched trough the oEvent Object as well as the returned object from calling this insinde the function. There is a mEventRegistry with an array named change, but I can not find the value in there. Is there any possiblity?

the object returned from this

Thanks!

In the event handler function, you have access to the oEvent object which contains every information about the source of the event. To access this object, just call oEvent.getSource() in your anonymous function body.

This will return with the source object, which holds the whole model and a most important thing - the path of the changed property. Just call the oEvent.getSource().getPath() to retrieve this information.

Now you know the path, so you can retrieve the value from the model.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM