PageFabric class

This class is provided in the Functions Javascript API.

Properties

Name
Type
Description
pageLanguage
string
Returns the language of the current page

pageLanguage [string]

Returns language of the current page (as you configured it in PageFabric).

The value is 2 characters ("en", "fr"...) or 5 characters ("fr-FR", "en-US"...).

let lang = PageFabric.pageLanguage;
console.log("You're visiting the " + lang + " version of the page");

Methods

Name
Description
getPartById(string)
Returns a Part class if a Part was found with the provided Id
openFlyoutWithURL(string, string)
Opens a side flyout with an iFrame to the specified URL
openPopupWithURL(string,string,string)
Opens a popup layer with an iFrame to the specified URL
refreshAllDataSources
Refreshes all the DataSources (connectors) and rebuilds all corresponding Parts

getPartById(partId)

Returns a Part class if a Part was found with the provided Id, or Null if no Part was found.


Arguments

  • partId (string) : Mandatory, the client id of the Part on your page.

let myPart = PageFabric.getPartById("myPart");

openFlyoutWithURL(url, width)

Opens a side flyout with an iFrame to a specified URL.


Arguments

  • url (string) : Mandatory, the url to open in the iFrame.
  • width (string) : Mandatory, the width of the flyout with the unit ("px" for absolute pixels or "%" for percent of the current window)

// open a flyout that takes 350 pixels on the right of the current window
PageFabric.openFlyoutWithURL("https://someurl.com", "350px");


// open a flyout that takes 25% of the current window
PageFabric.openFlyoutWithURL("https://someurl.com", "25%");

openPopupWithURL(url, width, height)

Opens a popup with an iFrame to a specified URL, at the center of the current window.


Arguments

  • url (string) : Mandatory, the URL to open in the iFrame.
  • width (string) : Mandatory, the width of the popup with the unit ("px" for absolute pixels or "%" for percent of the current window)
  • height (string) : Mandatory, the height of the popup with the unit ("px" for absolute pixels or "%" for percent of the current window)

// open a popup that is 750 pixels in width and 500 pixels in height
PageFabric.openPopupWithURL("https://someurl.com", "750px", "500px");

refreshAllDataSources()

Refreshes all the DataSources (aka connectors) and rebuilds all corresponding Parts.

If the onDataSourceUpdate event is set on any of the impacted Parts, the event will be raised.

// Reload all connectors and Parts that are bound to them
PageFabric.refreshAllDataSources();
Improve your PageFabric skills

Explore user guide

Have a question?

Join us on twitter