Skip to main content

SipaPage

SipaPage

SipaPage

Tool class with page loader with included router

SipaPage.config : SipaPageConfig

Kind: static property of SipaPage

SipaPage.load(page_id, options)

Load given page by page_id

ParamTypeDefaultDescription
page_idstringto load
optionsObject
options.layout_idstringspecify custom layout, overwrite default layout
options.force_loadbooleanfalseforce to load the page again, even if it is already loaded
options.fade_effectbooleantrueuse fade effect for the page container
options.stack_pagebooleantruestack page in page history
options.paramsObjectparameters to be set at the new page
options.keep_paramsbooleantruekeep parameters when loading other page
options.anchorstringanchor to be set at the new page
options.keep_anchorbooleanfalsekeep current anchor when loading other page
options.remove_paramsArray.<String>parameters to be removed at the new page
options.successfunctionfunction to be called after successful loading
options.errorfunctionfunction to be called after loading fails
options.alwaysfunctionfunction to be called always after successful/erroneous loading

SipaPage.extractIdOfTemplate(template, options) string

Get the id only of the given template

Returns: string - absolute path

ParamTypeDefaultDescription
templatestringid or path of page or layout
optionsObject
options.typePageType'page'

SipaPage.getClassNameOfTemplate(template, options) string

Get the class name of the given template

Returns: string - class name

ParamTypeDefaultDescription
templatestringid or path of page or layout
optionsObject
options.typePageType'page'

SipaPage.typeOptions(type) TypeOptionsType

Get the options of the given type

Returns: TypeOptionsType - type options

ParamType
typePageType

SipaPage.currentPageId() string

Get page id of current loaded page

Returns: string - page id

SipaPage.currentPageClass() SipaBasicView

Get current page class

SipaPage.currentLayoutId() string

Get layout id of current loaded layout

SipaPage.loadLayout(layout_id, options)

Load the given layout

ParamTypeDefaultDescription
layout_idstringto load
optionsObject
options.fade_effectbooleantruefade effect on layout change
options.keep_pagebooleanfalsekeep the loaded page, but change the layout only

SipaPage.callMethodOfPage(page_id, method_name, parameters)

Call the given method of the given page with given parameters (optional)

ParamType
page_idstring
method_namestring
parametersArray

SipaPage.callMethodOfLayout(layout_id, method_name, parameters)

Call the given method of the given layout with given parameters (optional)

ParamType
layout_idstring
method_namestring
parametersArray

SipaPage.initHistoryState()

Initialize the router for single page app browser history

SipaPage.stackHistoryState(state, replace_state)

Stack the current page and layout state to the browser history

ParamTypeDefault
stateObject
state.page_idstring
state.layout_idstring
state.optionsObject
replace_statebooleanfalse

SipaPage.setConfig(config)

Set the configuration of pages and layouts

ParamType
configSipaPage.Config

Example

SipaPage.setConfig({
// default layout for all pages
default_layout: 'default',
// specific layouts for some pages { <page-name>: <layout-name> }
default_layouts: {
// overwrites the layout for the page 'login-page' with layout 'mini-dialog'
'login-page': 'mini-dialog'
}
});

SipaPage.reset()

Reset all states

Useful for unit testing

SipaPage.PageType : Object

Custom type definitions for excellent IDE auto complete support

ParamType
default_layoutstring
default_layoutsObject
keep_anchorboolean

Properties

NameType
prefixstring
file_extstring