Skip to main content
Version: 1.21.3

SimpleList

This class provides methods for configuring lists. Use these methods to manage them, for example, in the scripts of the UI actions.

Global variable usage


Within any list, you can use the predefined global variable.

VariableDescription
currentUiActionContains an object with an ID of the UI action record. Use it when calling the context menu.
One of the use cases is receiving information about the UI actions when calling the context menu.

Example:

currentUiAction
window.currentUiAction

s_list.addErrorMessage(message)


Use this method to display an error toast message in the lower right corner.

Parameter(s):

NameTypeMandatoryDefault value
messageStringYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

addErrorMessage()
s_list.addErrorMessage('Please enter a valid email address using the following format: joe@example.com');

s_form.addInfoMessage(message, durationMilliseconds)


Use this method to display an informational toast message in the lower right corner. The message disappears after a certain period of time. In the durationMilliseconds parameter, specify this period in milliseconds.

Parameter(s):

NameTypeMandatoryDefault value
messageStringYN
durationMillisecondsNumberNN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

addInfoMessage()
s_form.addInfoMessage('Link copied to clipboard', 2000);

s_form.addSuccessMessage(message, durationMilliseconds)


Use this method to display a message about a successul action in the lower right corner. The message disappears after a certain period of time. Specify this period in milliseconds in the durationMilliseconds parameter.

Parameter(s):

NameTypeMandatoryDefault value
messageStringYN
durationMillisecondsNumberNN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

addSuccessMessage()
s_form.addSuccessMessage('Record was successfully added!', 3000);

s_form.addWarningMessage(message, durationMilliseconds)


Use this method to display a warning message in the lower right corner. The message disappears after a certain period of time. Specify this period in milliseconds in the durationMilliseconds parameter.

Parameter(s):

NameTypeMandatoryDefault value
messageStringYN
durationMillisecondsNumberNN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

addWarningMessage()
s_form.addWarningMessage('This record has been modified by another user', 3000);

s_list.deleteRows(tableName, sysIds)


Use this method to delete one or more selected records, their IDs are passed in the second parameter.

Parameter(s):

NameTypeMandatoryDefault value
tableNameStringYN
sysIdsArray of StringsYN

Return:

TypeDescription
ObjectThis method returns a Promise object that contains some specific data.
deleteRows()
s_i18n.getMessage("Delete the selected record(s)?", async (translationResponse) => {
if (confirm(translationResponse)) {
s_list.deleteRows(table, selectedRows)
.then(() => {
__resolveServerResponse();
s_list.refresh(table);
})
} else {
__resolveServerResponse();
}
});

s_list.getCheckedRow(tableName)


Use this method to get information about the strings that are checked on the list.

Parameter(s):

NameTypeMandatoryDefault value
tableNameStringYN

Return:

TypeDescription
Array of StringsThis method returns an array that contains the IDs of the strings checked. If no strings were checked, the method returns an empty array.
getCheckedRow()
const table = s_list.getTablesName()[0];
const selectedRows = s_list.getCheckedRow(table);
if (!selectedRows.length) {
s_i18n.getMessage("No selected rows.", (translationResponse) => {
__resolveServerResponse();
alert(translationResponse);
});
}

s_list.getQuery()


Use this method to return the filter condition for the displayed records in the list.

Return:

TypeDescription
StringThis method returns the condition formatted as an encoded query.
getQuery()
; (() => {
const url = new URL(`${API_BASE_URL}/list/${s_list.getTablesName()[0]}`);
url.searchParams.set('condition', s_list.getQuery());
window.open(url, '_blank');
})();

s_list.getTablesName()


Use this method to return an array with the names of the tables displayed in the window.

Return:

TypeDescription
Array of StringsThis method returns an array with the names of the tables.
getTablesName()
; (() => {
const url = new URL(`${API_BASE_URL}/list/${s_list.getTablesName()[0]}`);
url.searchParams.set('condition', s_list.getQuery());
window.open(url, '_blank');
})();

s_list.refresh(tableName)


Use this method to refresh the data on the list specified in the tableName parameter.

Parameter(s):

NameTypeMandatoryDefault value
tableNameStringYN

Return:

TypeDescription
VoidThis method does not return a value.
refresh()
if (confirm(translationResponse)) {
s_list.deleteRows(table, selectedRows)
.then(() => {
s_list.refresh(table);
})
}