Skip to main content
Skip table of contents

List Widget

Definition

The List Widget allows to display a list of results (external or internal data).

Capture d'écran 2024-02-02 172943.png

Configuration

Properties

Property name

Type

Mandatory

Description

Values (default in bold)

actions

List<Actions>

NO

Allows to configure one or several actions (like Button Widget or Groovy action rule for example).

The configuration properties of an action are those specified on the Button Widget configuration page.

-

allowExport

Boolean

NO

Allows to define if the export of the results data is allowed or not.

true, false

columns

List<Columns>

YES

Allows to configure the display of the columns.
See the page Search Widget for detailed informations.

-

rowClickActions

List<RowClickAction>

NO

Allows to configure the default action.
See the page Search Widget for detailed informations.

-

contentRule

Rule

YES

Allows to configure a rule to display the list of results.

-

Example

List Widget Example
CODE
<widget id="webservice-list" xsi:type="ctdbum:ListWidgetType">
	<hidden>false</hidden>
    <displayOptions>
    	<modalSize>LG</modalSize>
    </displayOptions>
    <config>
    	<actions/>
        <allowExport>true</allowExport>
        	<columns>
            	<column>
                	<attribute>true</attribute>
                    <dataKey>id</dataKey>
                    <dataType>string</dataType>
                    <dateFormat>DAY_MONTH_YEAR_LONG</dateFormat>
                    <ellipsis>false</ellipsis>
                    <hidden>false</hidden>
                    <sortAs>ALPHA</sortAs>
                    <sortDirection>ASC</sortDirection>
                    <sortable>true</sortable>
                    <sorted>true</sorted>
                    <type>general</type>
				</column>
                <column>
                	<attribute>true</attribute>
                    <dataKey>firstName</dataKey>
                    <dataType>string</dataType>
                    <dateFormat>DAY_MONTH_YEAR_LONG</dateFormat>
                    <ellipsis>false</ellipsis>
                    <hidden>false</hidden>
                    <sortAs>ALPHA</sortAs>
                    <sortDirection>ASC</sortDirection>
                    <sortable>true</sortable>
                    <sorted>false</sorted>
                    <type>general</type>
				</column>
                <column>
                	<attribute>true</attribute>
                    <dataKey>lastName</dataKey>
                    <dataType>string</dataType>
                    <dateFormat>DAY_MONTH_YEAR_LONG</dateFormat>
                    <ellipsis>false</ellipsis>
                    <hidden>false</hidden>
                    <sortAs>ALPHA</sortAs>
                    <sortDirection>ASC</sortDirection>
                    <sortable>true</sortable>
                    <sorted>false</sorted>
                    <type>general</type>
				</column>
			</columns>
            <rowClickActions/>
            <contentRule>
            	<script><![CDATA[
import com.memority.toolkit.rest.client.groovy.ContentType
int pageNumber = LIST_WIDGET.request.pagination.getIndex()
def pageSize = LIST_WIDGET.request.pagination.size
def params = [:] << [page:"$pageNumber", size:"$pageSize"]if (LIST_WIDGET.request.sort != null) {
params << [sort:"${LIST_WIDGET.request.sort.property},${LIST_WIDGET.request.sort.direction}"]
}
def result;
try {
    result = HTTP.get('http://idm-tnx.dev.citadel.intranet.lagoon.psa-cloud.com/nto/api/idm/identities') { basicAuth(usernamePassword('ws-test.credentials')) contentType ContentType.JSON queryParams params }
LOG.info("result = " + result)
LOG.info("resultJSON = " + (result.json as List).toString())} catch(Exception e) {
    def param = [:] << [url:"http://idm-tnx.dev.citadel.intranet.lagoon.psa-cloud.com/nto/api/idm/identities"]
    return ListWidgetRuleResult.failure("Failed to connect to the server", "tenant.error.connectionError.label", param as Map<String, Object>);
}
if (result.isSuccess()) {
    def content = ((result.json as Map)?._embedded as Map)?.identities as List
LOG.info("content = " + content)
    int totalCount = ((result.json as Map)?.page as Map)?.totalElements as int
    return ListWidgetRuleResult.success(content, pageNumber, pageSize, totalCount)
}
ListWidgetRuleResult.failure()                
				]]></script>
			</contentRule>
		</config>
	</widget> 

Read Next

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.