Child pages
  • Server Side Scripting

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Hooking up into component lifecycle

Two new function's support Support has been added in Servoy [version] for two new handler functions. These can be defined for hooking up into the component's client side destroy / create component's lifecycle on the client side:

showComponent() : which is called every time the component is going from hide to show

hideComponent(): which is called when component is going from show to hide.

Any wanted processing for these situations may be added by adding these two functions 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 what 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).

onShow: which will be called every time the component gets shown

Code Block
languagejs
$scope.onShow = function() {
  // code to execute when the component is shown/created at the client.    
}


onHide: which will be called every time the component gets hidden

Code Block
languagejs
$scope.onHide = function() {
  // code to execute when the component is hidden/destroyed at 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 spec and also component's .spec file
- defining them on in the server side scripting file of the component.

This support is available from Servoy Developer v 2022v2022.06.0