sap.ui.core.routing.Router.extend(sClassName, oClassInfo?, FNMetaImpl?)
: function
Creates a new subclass of class sap.ui.core.routing.Router 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.EventProvider.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
|
Returns a metadata object for class sap.ui.core.routing.Router.
Returns:
Get a registered router
Parameters:
{string}
|
sName
|
Name of the router
|
Returns:
addRoute(oConfig, oParent)
Adds a route to the router
Parameters:
{object}
|
oConfig
|
configuration object for the route @see sap.ui.core.routing.Route#constructor
|
{sap.ui.core.routing.Route}
|
oParent
|
The parent route - if a parent route is given, the routeMatched event of this route will also trigger the route matched of the parent and it will also create the view of the parent (if provided).
|
Attach event-handler fnFunction
to the 'bypassed' event of this sap.ui.core.routing.Router
.
The event will get fired, if none of the routes of the routes is matching.
Parameters:
{object}
|
oData?
|
The object, that should be passed along with the event-object when firing the event.
|
{function}
|
fnFunction
|
The function to call, when the event occurs. This function will be called on the
oListener-instance (if present) or in a 'static way'.
|
{object}
|
oListener?
|
Object on which to call the given function. If empty, this Model is used.
|
Returns:
Attach event-handler fnFunction
to the 'routeMatched' event of this sap.ui.core.routing.Router
.
Parameters:
{object}
|
oData?
|
The object, that should be passed along with the event-object when firing the event.
|
{function}
|
fnFunction
|
The function to call, when the event occurs. This function will be called on the
oListener-instance (if present) or in a 'static way'.
|
{object}
|
oListener?
|
Object on which to call the given function. If empty, this Model is used.
|
Returns:
Attach event-handler fnFunction
to the 'routePatternMatched' event of this sap.ui.core.routing.Router
.
This event is similar to route matched. But it will only fire for the route that has a matching pattern, not for its parent Routes
Parameters:
{object}
|
oData?
|
The object, that should be passed along with the event-object when firing the event.
|
{function}
|
fnFunction
|
The function to call, when the event occurs. This function will be called on the
oListener-instance (if present) or in a 'static way'.
|
{object}
|
oListener?
|
Object on which to call the given function. If empty, this Model is used.
|
Returns:
Removes the router from the hash changer @see sap.ui.core.routing.HashChanger
Returns:
Detach event-handler
fnFunction
from the 'bypassed' event of this
sap.ui.core.routing.Router
.
The event will get fired, if none of the routes of the routes is matching.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function}
|
fnFunction
|
The function to call, when the event occurs.
|
{object}
|
oListener
|
Object on which the given function had to be called.
|
Returns:
Detach event-handler
fnFunction
from the 'routeMatched' event of this
sap.ui.core.routing.Router
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function}
|
fnFunction
|
The function to call, when the event occurs.
|
{object}
|
oListener
|
Object on which the given function had to be called.
|
Returns:
Detach event-handler
fnFunction
from the 'routePatternMatched' event of this
sap.ui.core.routing.Router
.
This event is similar to route matched. But it will only fire for the route that has a matching pattern, not for its parent Routes
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function}
|
fnFunction
|
The function to call, when the event occurs.
|
{object}
|
oListener
|
Object on which the given function had to be called.
|
Returns:
Fire event bypassed to attached listeners.
The event will get fired, if none of the routes of the routes is matching.
Parameters:
{object}
|
mArguments?
|
the arguments to pass along with the event.
|
Returns:
Fire event routeMatched to attached listeners.
Parameters:
{object}
|
mArguments?
|
the arguments to pass along with the event.
|
Returns:
Fire event routePatternMatched to attached listeners.
This event is similar to route matched. But it will only fire for the route that has a matching pattern, not for its parent Routes
Parameters:
{object}
|
mArguments?
|
the arguments to pass along with the event.
|
Returns:
Returns the Route with a name, if no route is found undefined is returned
Parameters:
{string}
|
sName
|
Name of the route
|
- Since:
- 1.25.1
Returns:
Returns the instance of Targets, if you pass a targets config to the router
Returns:
{sap.ui.core.routing.Targets|undefined}
|
The instance of targets, the router uses to place views or undefined if you did not specify the targets parameter in the router's constructor.
|
getURL(sName, oParameters?)
: string
Returns the URL for the route and replaces the placeholders with the values in oParameters
Parameters:
{string}
|
sName
|
Name of the route
|
{object}
|
oParameters?
|
Parameters for the route
|
Returns:
{string}
|
the unencoded pattern with interpolated arguments
|
Returns the views instance created by the router
- Since:
- 1.28
Returns:
Attaches the router to the hash changer @see sap.ui.core.routing.HashChanger
Returns:
Navigates to a specific route defining a set of parameters. The Parameters will be URI encoded - the characters ; , / ? : @ & = + $ are reserved and will not be encoded.
If you want to use special characters in your oParameters, you have to encode them (encodeURIComponent).
IF the given route name can't be found, an error message is logged to the console and the hash will be changed to empty string.
Parameters:
{string}
|
sName
|
Name of the route
|
{object}
|
oParameters?
|
Parameters for the route
|
{boolean}
|
bReplace?
|
Defines if the hash should be replaced (no browser history entry) or set (browser history entry)
|
Returns:
parse(sNewHash)
Will trigger routing events + place targets for routes matching the string
Parameters:
{string}
|
sNewHash
|
a new hash
|
register(sName)
Registers the router to access it from another context. Use sap.ui.routing.Router.getRouter() to receive the instance
Parameters:
{string}
|
sName
|
Name of the router
|
Stops to listen to the hashChange of the browser.
If you want the router to start again, call initialize again.
Returns:
Attach event-handler fnFunction
to the 'viewCreated' event of this sap.ui.core.routing.Router
.
Parameters:
{object}
|
oData?
|
The object, that should be passed along with the event-object when firing the event.
|
{function}
|
fnFunction
|
The function to call, when the event occurs. This function will be called on the
oListener-instance (if present) or in a 'static way'.
|
{object}
|
oListener?
|
Object on which to call the given function. If empty, this Model is used.
|
- Deprecated:
-
Since 1.28 use getViews instead.
Returns:
Detach event-handler
fnFunction
from the 'viewCreated' event of this
sap.ui.core.routing.Router
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function}
|
fnFunction
|
The function to call, when the event occurs.
|
{object}
|
oListener
|
Object on which the given function had to be called.
|
- Deprecated:
-
Since 1.28 use getViews instead.
Returns:
Fire event viewCreated to attached listeners.
Parameters:
{object}
|
mArguments?
|
the arguments to pass along with the event.
|
- Deprecated:
-
Since 1.28 use getViews instead.
Returns:
Returns a cached view for a given name or creates it if it does not yet exists
Parameters:
{string}
|
sViewName
|
Name of the view
|
{string}
|
sViewType
|
Type of the view
|
{string}
|
sViewId
|
Optional view id
|
- Deprecated:
-
Since 1.28.1 use getViews instead.
Returns:
Adds or overwrites a view in the viewcache of the router, the viewname serves as a key
Parameters:
- Deprecated:
-
Since 1.28 use getViews instead.
- Since:
- 1.22
Returns: