SC.pagedata.js
SC.pagedata.startPageDataLoop(invokeServiceProc)
Starts a loop used to monitor when data displayed on the page should be refreshed. The loop may only be started once. Depending upon which service method is invoked, the relevant data is stored into the DOM
Parameters
| Name | Type | Description |
| invokeServiceProc | function |
The specific server-side function that returns the relevant page information |
Return type
void
Example
When a user visits the Guest page, a loop is started within their browser to ensure that when they enter a code an appropriate session is found, if it exists.
SC.pagedata.startPageDataLoop(function (version, onSuccess, onFailure) {
return SC.service.GetGuestSessionInfo(
getTaggedValuesFunc('Code'),
getTaggedValuesFunc('SessionID'),
version,
onSuccess,
onFailure
);
});
SC.pagedata.set(data)
Used to store the relevant pageData information within the DOM.
Parameters
| Name | Type | Description |
| data | DOM Object | An object containing information formatted specifically for each page on which its used |
Return type
void
Example
When a user visits the Audit tab on the Administration page, the current Audit level is displayed in the top-right corner of the page. This information is stored within the Audit page’s pagedata,
SC.service.GetAuditInfo(function (auditInfo) {
SC.pagedata.set(auditInfo);
SC.ui.setContents(document.querySelector('.AuditList'), [
…
SC.pagedata.get()
Used to retrieve the current page’s pagedata.
Parameters
| Name | Type | Description |
| None |
Return type
Returns a DOM object containing the relevant pagedata.
Example
Within the Audit tab on the Administration page, when a user attempts to change their current audit level, a modal is created and its contents are populated by pulling the current audit level from the Audit tab’s pagedata.
SC.dialog.createContentPanel(
Object.keys(SC.types.AuditLevel).map(function (_) {
return $label([
$input({ type: 'radio', name: 'AuditLevel', value: SC.types.AuditLevel[_], checked: SC.pagedata.get().AuditLevel == SC.types.AuditLevel[_] }),
$h3({ _textResource: SC.util.formatString('AuditPanel.{0}LevelTitle', _) }),
$p({ _textResource: SC.util.formatString('AuditPanel.{0}LevelDescription', _) }),
]);
})
),
SC.pagedata.notifyDirty(dirtyLevel)
Dispatches an event to notify that the PageData is dirty and should be refreshed.
Parameters
| Name | Type | Description |
| dirtyLevel | enum |
Determines which, if any, element should be specifically refreshed
|
Return type
void
Example
On the Host page, when a Support or Meeting session is created it should automatically be highlighted and informs the page to refresh the data for that specific element.
function createAndSelectSession(sessionType) {
Array.from($('.DetailTabList').childNodes).forEach(function (dt) {
SC.ui.setSelected(dt, dt._commandArgument == 'Start');
});
SC.service.CreateSession(
sessionType,
SC.res['SessionPanel.New' + SC.util.getEnumValueName(SC.types.SessionType, sessionType) + 'SessionName'],
false,
SC.util.getRandomStringFromMask(SC.res['SessionPanel.GenerateCodeMask']),
null,
function (sessionID) {
window.setSearchUrlPart(null);
window.setSessionUrlPart(sessionID);
window.setCommandNameUrlPart('ProcessSessionCreated');
window.updateHashBasedElements(false);
SC.dialog.hideModalDialog();
SC.pagedata.notifyDirty(window._dirtyLevels.SessionDetails);
}
);
}
