Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This class provides methods to configure lists. Use these methods to manipulate them, for example, in the UI actions.
Global variable usage
Within any list, you can use the predefined global variable.
Variable | Description |
---|---|
currentUiAction |
s_list.addErrorMessage(message)
This method displays an error toast message in the bottom right corner.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
message | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return any value. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
s_list.addErrorMessage('Please enter a valid email address using the following format: joe@example.com'); |
s_list.addInfoMessage(message, durationMilliseconds)
This method displays info messages when working with lists. They appear in the bottom right corner. The message disappears after a certain period of time. Specify this period in milliseconds in the second parameter.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
message | String | Y | N |
durationMilliseconds | Number | N | N |
Return:
Type | Description |
---|---|
Void | This method does not return any value. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
s_list.addInfoMessage('Link copied to clipboard', 2000); |
s_list.addSuccessMessage(message, durationMilliseconds)
This method displays success messages when working with lists. They appear in the bottom right corner. The message disappears after a certain period of time. Specify this period in milliseconds in the second parameter.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
message | String | Y | N |
durationMilliseconds | Number | N | N |
Return:
Type | Description |
---|---|
Void | This method does not return any value. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
s_list.addSuccessMessage('Record was successfully updated!', 3000); |
s_list.addWarningMessage(message, durationMilliseconds)
This method displays warning messages when working with lists. They appear in the bottom right corner. The message disappears after a certain period of time. Specify this period in milliseconds in the second parameter.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
message | String | Y | N |
durationMilliseconds | Number | N | N |
Return:
Type | Description |
---|---|
Void | This method does not return any value. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
s_list.addWarningMessage('This record has been modified by another user', 3000); |
deleteRows(tableName, sysIds)
This method allows deleting one or more selected rows in the table.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
tableName | String | Y | N |
sysIds | Array | Y | N |
Return:
Type | Description |
---|---|
Object | This object returns a promise contains specific data. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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(); } }); |
getCheckedRow(tableName)
This method is useful for getting information on which strings are checked on the list.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
tableName | String | Y | N |
Return:
Type | Description |
---|---|
Array | An array containing IDs of the strings checked; if no strings were checked, then the method returns the empty array. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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); }); } |
getQuery()
This method returns the list condition.
Return:
Type | Description |
---|---|
String | A condition formatted as an encoded query. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
; (() => { const url = new URL(`${API_BASE_URL}/list/${s_list.getTablesName()[0]}`); url.searchParams.set('condition', s_list.getQuery()); window.open(url, '_blank'); })(); |
getTablesName()
This method returns the tables list.
Return:
Type | Description |
---|---|
Array | The tables list. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
; (() => { const url = new URL(`${API_BASE_URL}/list/${s_list.getTablesName()[0]}`); url.searchParams.set('condition', s_list.getQuery()); window.open(url, '_blank'); })(); |
refresh(tableName)
This method refreshes data on the list specified in the tableName parameter.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
tableName | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return any value. |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
if (confirm(translationResponse)) { s_list.deleteRows(table, selectedRows) .then(() => { s_list.refresh(table); }) } |
Table of Contents | ||||
---|---|---|---|---|
|