Skip to content

siteSettings.Sections

Overview

This is the "Sections Object" of the "siteSettings object". This is a method to change the "Section" settings in the "Server Script".

Properties

No Property name Type Change Description
1 Id int No ID of the target section
2 LabelText string Yes Label name of the target section
3 AllowExpand bool Yes Specify whether to allow section folding
4 Expand bool Yes Specify the default display

Usage Example 1

In the following example, the ID of the first section is set to NumA.

JavaScript
model.NumA = siteSettings.Sections[0].Id;

Usage Example 2

The following example sets the LabelText (Input column) for the second section.

JavaScript
siteSettings.Sections[1].LabelText = 'Input column';

Usage Example 3

The following example sets AllowExpand (allow) for the first section.

JavaScript
siteSettings.Sections[0].AllowExpand = true;

Usage Example 4

The following example sets the default display (close) of the second section.

JavaScript
siteSettings.Sections[1].Expand = false;

Code Samples

1. Control the expansion of sections according to the status

Controls whether sections are expanded or collapsed according to the status.

To run this sample code, in the settings of the section item, select the "Allow expand" check box and set "Default expansion" to "Close".

JavaScript

Condition: Before opening the page

const rules = {
    150: 0,
    200: 1,
    300: 2,
    900: 3,
};
const sectionIndex = rules[model.Status];
if (sectionIndex !== undefined) {
    siteSettings.Sections[sectionIndex].Expand = true;
}