Namespace sap.ui.core.ResizeHandlerModule: sap/ui/core/ResizeHandler

extends Object

The resize handling API provides firing of resize events on all browsers by regularly checking the width and height of registered DOM elements or controls and firing events accordingly.

Method Summary
sap.ui.core.ResizeHandler.deregister(sId)Deregisters a previously registered handler for resize events with the given registration ID.
sap.ui.core.ResizeHandler.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.ResizeHandler with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.core.ResizeHandler.getMetadata()Returns a metadata object for class sap.ui.core.ResizeHandler.
sap.ui.core.ResizeHandler.register(oRef, fHandler)Registers the given event handler for resize events on the given DOM element or control.
Method Detail
sap.ui.core.ResizeHandler.deregister(sId)
Deregisters a previously registered handler for resize events with the given registration ID.
Parameters:
{string}sId The registration ID of the handler to deregister. The ID was provided by function sap.ui.core.ResizeHandler.register when the handler was registered.
sap.ui.core.ResizeHandler.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.ResizeHandler with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.core.ResizeHandler.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.ResizeHandler.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
sap.ui.core.ResizeHandler.register(oRef, fHandler): string
Registers the given event handler for resize events on the given DOM element or control.

Note: This function must not be used before the UI5 framework is initialized. Please use the init event of UI5 if you are not sure whether this is the case.

The resize handler periodically checks the dimensions of the registered reference. Whenever it detects changes, an event is fired. Be careful when changing dimensions within the event handler which might cause another resize event and so on.

The available parameters of the resize event are:

  • oEvent.target: The DOM element of which the dimensions were checked
  • oEvent.size.width: The current width of the DOM element in pixels
  • oEvent.size.height: The current height of the DOM element in pixels
  • oEvent.oldSize.width: The previous width of the DOM element in pixels
  • oEvent.oldSize.height: The previous height of the DOM element in pixels
  • oEvent.control: The control which was given during registration of the event handler (if present)
Parameters:
{DOMRef|sap.ui.core.Control}oRef The control or the DOM reference for which the given event handler should be registered (beside the window)
{function}fHandler The event handler which should be called whenever the size of the given reference is changed. The event object is passed as first argument to the event handler. See the description of this function for more details about the available parameters of this event.
Returns:
{string} A registration ID which can be used for deregistering the event handler, see sap.ui.core.ResizeHandler.deregister. If the UI5 framework is not yet initialized null is returned.