Functions

Public functions

Components
setComponentProperty(componentId, propertyName, propertyValue)

Sets or updates a component property. A property can have any name/value. Properties are attached to the API call when loading a component.

setComponentGroupProperty(groupName, propertyName, propertyValue)

Sets a property on all components that have a group name equal to groupName.

getComponentProperty(componentId, propertyName)

Gets a component property. 

deleteComponentProperty(componentId, propertyName)

Deletes a component property. 

deleteComponentGroupProperty(groupName, propertyName)

Deletes a property on all components that have a group name equal to groupName.

setComponentDataOnly(componentId, dataOnly)

Sets a component's dataonly property. If true, JSON result will be saved, not rendered. If false, JSON result will be rendered, not saved (default). 

setComponentGroupDataOnly(componentId, dataOnly)

Sets the dataonly property on all components that have a group name equal to groupName.

reloadComponent(componentId)

Reloads a component. 

reloadComponents(arrayOfComponentIds)

Reloads all components in the given array. 

reloadGroupComponents(groupName)

Reloads all components that have a group name equal to groupName.

reloadAllComponents()

Reloads all components.

reloadPageComponents(pageIndex)

Reloads all components on page with index pageIndex (zero based).

reloadPageComponentsFromPageId(pageId)

Reloads all components on a page with id pageId.

getComponentFromId(componentId)

Returns the component with the given id as a DOM object.

getComponentElementFromId(componentId)

Returns the component with the given id as a DOM object.

Deprecated, use getComponentFromId instead.

getSavedJsonData(componentId)

Returns a component's saved JSON data. Note: Saved data is automatically cleared after this call to save memory. Returns undefined if no data was available. 

Pages
showPage(pageIndex)

Shows a page with index pageIndex (zero based). Should only be called if a specific page has to be shown, page changes are normally handled by the user.

nextPage()

Shows the next page. Should only be called if a specific page has to be shown, page changes are normally handled by the user.

prevPage()

Shows the previous page. Should only be called if a specific page has to be shown, page changes are normally handled by the user.

getPageFromId()

Returns the page with the given id as a DOM object.

getPageFromIndex(pageIndex)

Returns the page with the given index (zero based) as a DOM object.

getPageIdFromPageIndex(pageIndex)

Returns page id from page index, returns empty string if not found.

getPageIndexFromPageId(pageId)

Returns page index (zero based) from page id, returns -1 if not found.

getPageCount()

Returns the number of pages.

getCurrentPageIndex()

Returns page index (zero based) of the current page. 

Other functions
setAppTitle(title)

Sets the application title. Changes the browser's toolbar/tab title.
Default title: "MI Pro Report Application" or the value defined in reportapp.config.json. 
Note: custom scripts can only run after a successful login, use the page model's settings element to change the title globally and/or on the login page.

setFavicon(url)

Sets the browser's url icon.
Default icon: default Superdig icon or the icon defined in reportapp.config.json.
Note: custom scripts can only run after a successful login, use the page model's settings element to change the icon globally and/or on the login page.

triggerEvent(event, data)

Triggers an event.

toggleIconColor()

Alternates between black and white (default) icons.

addStylesheet(cssObject)

Loads an external CSS file. This function is automatically called for each stylesheet reference found in the page model but can also be called manually. (cssObject: {href: string, cache: boolean})

loadAndExecuteScripts(scriptUrlArray, index, callback)

Loads external script files. This function is automatically called with script references found in the page model but can also be called manually. Index is the array position for the first script URL that will be loaded. Callback is the function that will be called when all scripts have been loaded and parsed.

showAlert(msg)

Displays a non-blocking alert message. Note that this does not use the browser’s alert functionality.

showLoadingAnimation()

Displays a general page centered loading animation.

hideLoadingAnimation()

Hides the loading animation, see showLoadingAnimation().

logout()

Logs out the current user and returns to the login page.

reload()

Reloads the report, forces a full refresh.

stringIsNullOrEmpty(str)

Returns a value indicating if a string is null or empty.

reflowHighchartsOnPage(pageElement)

Reflows all previously loaded Highcharts components found in the given page. This function is automatically called when a page is shown or when screen orientation changes to ensure that rendered charts fit the page.

reflowHighchartsOnCurrentPage()

See reflowHighchartsOnPage

Private functions

Note: the following functions are always accessible but should never be called externally. init()

Handles application initialization.

initStartPage()

Handles start page initialization and application configuration.

initLoginView1()

Handles login page initialization.

initLoginView2()

Handles login page initialization.

initLoginView3()

Handles login page initialization.

initLoginView4()

Handles login page initialization.

initResultView()

Handles content page initialization.

continueInitStartPage()

Callback, handles initial API calls, reloads and application state.

handleStartSuccess(data, loginType)

Callback, handles a successful start initialization and creates login pages.

handlePreLoginSuccess(data, auth)

Callback, handles API session calls.

handleLoginFailure(textStatus, errorThrown)

Callback, handles login failures.

restore(hashid, loginType, shortKey)

Handles state restorations.

continueRestore(pagesObj, wasReloaded)

Callback, handles state restorations.

buildContentPages(pages)

Creates pages and components.

continueReload()

Callback, handles a reload.

showContentView()

Displays dynamically created pages.

setSideBar()

Creates the side bar.

createSideBarItem()

Creates a side bar item.

renderComponent()

Handles analysis API calls for components.

continueRenderComponent()

Callback, handles component rendering.

generateHashId()

Creates application specific and unique identifiers.