Widget objectUpdateNotification and update

When are the functions 'objectUpdateNotification' and 'update' called in a widget? The documentation states: http://apidocs.mendix.com/4/client/widget.html "This method is called to update a widget when the context changed." I did implement the functions in a widget but they are never called. even on refresh of the context object. Do you need to subscribe to get the notification or did I missed a testing scenario? Thank you, Andries
2 answers

In Mendix 2, the objectUpdateNotification method was called for updates of all objects to which you were subscribed to in the widget. The downside of this approach was that if you had subscriptions to multiple objects which should be handled differently, the objectUpdateNotification method should handle all these cases. That is why in Mendix 3 the subscribe method was introduced. The subscribe method takes a callback function, which is called when an update occurs for that particular subscription. Since Mendix 3 the objectUpdateNotification method does not have a special meaning anymore, and it will never be called by the client.

Also as of Mendix 3 the update method of a widget replaces the applyContext method. The update method is called after the widget is instantiated and is given context by its parent widget (e.g. a data view). This method can be called more than once, for instance when the widget is in a listening data view and the selection of the data source grid changes.

If you are interested in entity / object / attribute changes, the subscribe method on the widget should be used.


May be your answer is in this post.