Page History
...
Support has been added in Servoy 2022.06 for two new handler functions. These can be defined for hooking up into the component's client side destroy / create lifecycle.
These two methods will be called directly in server-side scripting when the component is shown/hidden on client. They are useful because - for example - some components want to do cleanup actions when they get hidden - but it is too late to call a server-side api when the component detects that it is destroyed on client, because server will normally block that call - the form is already known to be hidden (sometimes, in rare cases, at that point it may even be destroyed).
Any code the component wants to execute server-side for show/hide can be added to these two functions by:
- defining them in the server side scripting file of the component
onShow: which will be called every time the component gets shown
Code Block language js $scope.onShow = function() { // code to execute when the component is shown/created in the client. }
onHide: which will be called every time the component gets hidden
Code Block language js $scope.onHide = function() { // code to execute when the component is hidden/destroyed in the client. }
Any code the component wants to execute server-side for show/hide can be added to these two functions by:
defining them in the internalApi section of the component's .spec file
defining them in the server side scripting file of the component:
Code Block language js "internalApi": { "onHide": {}, "onShow": {} }