Dropdown

Overview

The Dropdown component is a contractual component that displays the list of options, such as the list of currencies, countries, frequencies, payment methods, and contact type(In P2P flow). The Dropdown component provides the following UI features to the developer for customization.

  • Make the list of options selectable or not selectable.
  • A main header to the drop-down.
  • Options to provide section headers, if required.
  • Provides search functionality in the drop-down using the Keyword Search component.

NOTE: The Dropdown component is used inside the Mobile Banking application.

The Dropdown component contains contracts for customizing the widgets and UI of the component. The Dropdown component contains the following contracts for customization.

Service Parameters

The Service Parameters contract of the Dropdown component provides services that help to set the service details to get the response data. The Dropdown component uses the DropdownServiceObject to retrieve the data. This data is then mapped to the widgets using the Data Mapping property and then displayed on the screen.

Here is a sample of the JSON object provided in the Service Parameter of the Dropdown component.

{
	"DropdownServiceObject": {
		"ServiceType": "",
		"Service": "",
		"Object": "",
		"Verb": "",
		"Criteria": {},
	}
}

The Service Parameter contract provides the following key-value pairs for customization.

Property Description
ServiceType

Type: String

Defines the type of service to be performed.

For example: customVerb, getByCriteria

Service

Type: String

Name of the object service mentioned in the Quantum Fabric layer to fetch the data and meta data required for the component.

Object

Type: String

Name of the object linked to the object service mentioned above in the Quantum Fabric layer to fetch the data required for the component.

Verb

Type: String

Name of the operation or custom verb linked to the specified objects in the Quantum Fabric layer to fetch the data required for the component.

Criteria

Type: JSON object

The request payload is defined and configured in the Quantum Fabric Object service and operation.

Data Mapping

The Data Mapping contract of the Dropdown component maps the widget IDs with the data to be displayed. This data is retrieved from the Data Collection Object, Context variable, or Service response.

Here is a sample of the JSON object provided in the Data Mapping of the Dropdown component.

{
	"mainHeaderTitle": {
		"lblDropdownHeaderTitle": "${CNTX.data.mainHeaderTitle}"
	},
	"segDropdown": {
		"segmentMasterData": "${CNTX.data.records}",
		"segmentUI": {
			"sectionHeader": [{
				"groupingParam": {
					"currencyType": "existing"
				},
				"lblDropdownSectionTitle": "${CNTX.data.sectionHeaderTitle}"
			}],
			"segmentRowData": {
				"countryId": "${segmentMasterData.countryId}",
				"imgFlag": "${segmentMasterData.countryFlag}",
				"lblCountry": "${segmentMasterData.countryName}",
				"lblCountryCodeOrCurrency": "${segmentMasterData.countryCode}",
				"countryOrCurrencyCode": "${segmentMasterData.countryCode}"
			}
		}
	}
}

The Data Mapping contract is assigned a JSON object with the following key-value pairs.

Key Description
mainHeaderTitle

This parameter maps the widgets and data required for the heading of the Dropdown component.

segDropdown

This parameter maps the segment with the section header(s) and row templates required for the component.

  • segmentMasterData: This key configures whether the response from service call or the context data from parent of the component is to be rendered on the component. This key can have any of the following values.
    • ${Collection.DropdownServiceObject}: To map the service response.
    • ${CNTX.data}: To map the context data sent from the component consumer.
  • segmentUI: This key is used to bind the info of widgets to be rendered with the corresponding tokens in a JSON format. For more information about how to set the data in this key refer to the Important Considerations section.
    The JSON object contains the following key-value pairs.
    • sectionHeader: Maps widgets and associated tokens for section header. An Array of JSON objects containing the following key value pairs is assigned to this key.
      • groupingParam: This parameter is used to group multiple sections based on a key. This parameter is assigned a JSON object with the parameter based on which the grouping is to be done as key and the grouping identifier as the value.
    • segmentRowData: Maps widgets and associated tokens for the row template.

Important Considerations

To map data with the widgets inside the segmentUI key, follow these formats.

  • To map a plain string, provide the text in the String format. For example, to map a text with lblCountry, follow this format.
    "lblCountry": "Country Name"
  • To map an i18n value, provide the i18n key value in a String format. In the following example, the lblCountry Label is mapped with the i18n key for the name of the account.
    "lblCountry": "${i18n{i18n.common.countryCode}}"
  • To map a context or a collection object, provide the value in a String format. In the following example, the lblCountry Label is mapped to the Account Type data retrieved from the Context Data Object.
    "lblCountry": "${segmentMasterData.countryName}"
  • While designing a new template, follow proper widget naming conventions. For example, the name of a Label widget must start with lbl and the name of an Image widget must start with img.

Data Formatting

The Data Formatting property is used to provide a custom format for a specific requirement. By default, this component does not contain any value in the Data Formatting contract.

{}

Conditional Mapping Key

The Conditional Mapping Key is used to define mapping based on a criterion.

For example, if a label defined in the UI must display different data according to the type of account, a developer must set the Conditional Mapping Key property to the following value. By default, the Dropdown component does not contain any value for this contract.

{}

Conditional Mapping

Configuration of this property is tightly coupled with the Boolean value of conditionalMappingKey property. The Conditional Mapping property key is used to map a widget with a data from Collection Object or service response as per the Conditional Mapping key. By default, the Dropdown component does not contain any value for this contract.

{}

Dropdown

Row Template Config

Assigns the dynamic template configurations to display the details for the unselected options in a tabular format. If this field is empty, then the entire Segment is not displayed. A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempDropdown3, where flxTempDropdown3 is the row template ID.
  • JSON Format: This format is used to support the inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

The row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.

Default Value

{
	"templateID": "flxTempDropdown3",
	"microAppName": "ResourcesMA"
}

Type

JSON/ String

Selected Row Template Config

Assigns the row template to display the selected options in the Segment. If this field is empty, then the Segment will appear row templates. A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID in a String format. For example: flxTempDropdown4, where flxTempDropdown4 is the row template ID.
  • JSON Format: This format is used to support the inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

The row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the dynamic row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.

Default Value

{
	"templateID": "flxTempDropdown4",
	"microAppName": "ResourcesMA"
}

Type

JSON/ String

Header Template Config

Assigns the section header template to the Segment displaying the options. If this field is empty, then the Segment will appear with out a header. A developer can set the value for this contract in two formats.

  • String Format: The header template ID in a String format. For example: flxTempDropdown1, where flxTempDropdown1 is the row template ID.
  • JSON Format: This format is used to support the inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

The row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the header template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.

Default Value

{
	"templateID": "flxTempDropdown1",
	"microAppName": "ResourcesMA"
}

Type

JSON/ String

Records Per Page

The Records Per Page field helps to achieve lazy loading in the Dropdown Component. For example, the Records Per Page is set as 10. When the user scrolls down to the end of the Segment, ten more records are appended to the end of the Segment.

If lazy loading is not required and the entire data needs to be set only once, then the value of Records Per Page field must be set as zero. This field does not accept any negative values.

Parameter Value

Syntax

Integer

Default Value

20

Type

Integer

Enable Search

This field is used to enable the search functionality in the Dropdown component. When this field is set as true, then the Keyword Search component (child) is enabled.

Parameter Value

Syntax

Boolean

Default Value

true

Type

Boolean

Default Selection Config

This field is used to select a row by default (prior to user selection) when the drop-down list appears.

Parameter Value

Syntax

JSON object containing the key and row number of the option as values.

Default Value

{
	"key": "countryId",
	"value": "5"
}

Type

JSON

Sorting Config

This field sets the order of the rows in the drop-down list.

Parameter Value

Syntax

JSON object containing the following key value pairs.

  • sortOrder: Sets the order of display. This field can have any of the following values.
    • ASC: for ascending order
    • DESC: for descending order
  • field: Sets the key based on which the sorting is done.

Default Value

{
	"sortOrder": "ASC",
	"field": "name"
}

Type

JSON

Enable Case Sensitive Search

When this field is enabled, the component differentiates between the capital and lower case letters while searching through the drop-down list.

Parameter Value

Syntax

Boolean

Default Value

false

Type

Boolean

Height of Dropdown

This field sets whether the height of the drop-down list.

Parameter Value

Syntax

Provides the following values in the selector:

  • Half screen: The dropdown list covers 50% of the screen when this option is selected.
  • Full screen: The dropdown list covers 100% of the screen when this option is selected.

Default Value

Half screen

Type

List Selector

Keyword Search

The Keyword Search component is used inside the Dropdown component. The following contracts of the Keyword Search component are applicable for the Dropdown component.

The contracts in this section will only work if the Enable Search option is enabled.

Service Parameters

The Service Parameters contract of the Keyword Search component provides services helps to set the service details to get the response data. The response data retrieved from the service is mapped to the widgets using the Data Mapping property and then displayed on the screen.

Here is a sample of the JSON object provided in the Service Parameter of the Keyword Search component.

{
  "ObjectName": {
    "ServiceType" : "",
    "Service": "",
    "Object": "",
    "Verb": "",
    "Criteria": {}
  }
}

The Service Parameter contract provides the following key-value pairs for customization.

Property Description
ServiceType

Type: String

Defines the type of service to be performed.

For example: customVerb, getByCriteria

Service

Type: String

Name of the object service mentioned in the Quantum Fabric layer to fetch the data and meta data required for the component.

Object

Type: String

Name of the object linked to the object service mentioned above in the Quantum Fabric layer to fetch the data required for the component.

Verb

Type: String

Name of the operation or custom verb linked to the specified objects in the Quantum Fabric layer to fetch the data required for the component.

Criteria

Type: JSON object

The request payload as defined and configured in the Quantum Fabric Object service and operation.

Data Mapping

The Data Mapping property of the Keyword Search component maps the widget IDs with the data to be displayed. The data is retrieved from Data Collection Object, Context variable, or Service response. The Data Mapping property of the Keyword Search component maps the i18n key and the text to be displayed as a String.

Here is a sample of the JSON object provided in the Data Mapping of the Keyword Search component.

{
  "txtSearchBox":{
    "placeholder" :"Enter search text here",
    "restrictChar":"#@",
    "maxCharacters":"10",
    "rightPaddinginDP":"80",
    "skins": {
      "focus": "flxWhitePrimary500S",
      "regular": "flxWhiteGrey200S"
    }
  },
  "btnCancel":{
    "text" :"Cancel"
   }
}

The Data Mapping contract is assigned a JSON object with the following key-value pairs.

Key Description
txtSearchBox

A JSON object with the following key- value pairs

  • placeholder: Sets the filler text for the search input box.
  • restrictChar: Sets the characters that the user is not allowed to enter in the search input box.
  • maxCharacters: Sets the maximum number of characters that can be entered in the search input box.
  • rightPaddinginDP: Sets the padding to the right of the input box.
  • skins: Sets the normal and focus skins of the input box.
btnCancel

A JSON object with the following key value pair.

  • text: Sets the text for the search button.

Data Formatting

The Data Formatting property is used to provide a custom format for a specific requirement. By default, the Keyword Search component does not contain any customization.

{}

Conditional Mapping Key

The Conditional Mapping Key is used to define mapping based on a criterion.

For example, if a label defined in the UI must display different data according to the type of account, a developer must set the Conditional Mapping Key property to the following value. By default, the Keyword Search component does not contain any value for this key.

{}

Conditional Mapping

The Conditional Mapping property key is used to map a widget with a data from Collection Object or service response as per the Conditional Mapping key. By default, the Keyword Search component does not contain any customization for this key.

{}

onError event

The OnError event is invoked when an error occurs during the user journey. When the onError event is invoked, an error object is passed to the parent widget. This object contains the information about the error as well as where it had occurred.

Parameter Value
Input parameter JSON object

Object Description

The JSON object contains the following keys:

  • level: This key contains the String value regarding the place in which the error occurs. It can be from the component View controller or from the component Business controller.
  • method: This key contains the method in which the error occurs.
  • error: This key contains the actual error message and the stack.

Sample Input

var errordata = {
	"level": "ComponentViewController",
	"method": "render",
	"error": err
};
this.onError(errordata);

onRowSelection Event

The onRowSelection event is triggered when the user selects an option in the Dropdown component.

Parameter Value
Input parameter

selectedRowDataObject: The details of the option selected by the user.

Programmatic Name onRowSelection

Sample Code

var selectedRowDataObject = {
	"countryId": "countryId",
	"countryFlag": "imgFlag",
	"countryName": "countryName",
	"countryOrCurrencyCode": "countryOrCurrencyCode"
};
this.view.dropdown.onRowSelection = function(selectedRowDataObject) {};

Return Type

None

onClose Event

This event is invoked when the user clicks the Close icon or anywhere outside the drop-down list.

Parameter Value
Input parameter

NA

Programmatic Name onClose

Sample Code

this.view.dropdown.onClose = function () {};

Return Type

None

setContext Method

This method is invoked inside the parent component or form controller. This method is used to retrieve the data from the parent of the component and set it in the Dropdown component.

Parameter Value

Syntax

this.view.componentID.setContext(contextdata);

Input parameter

JSON object containing the Context Data Object. For more information on the context object, click here.

Sample Input

this.view.dropdown.setContext(contextData);

Return Type

None

displayDropdown Method

This method is used by the parent of the component to display the drop-down list.

Parameter Value

Syntax

this.view.<ComponentID>..displayDropdown();

Input parameter

NA

Sample Input

this.view.dropdown.displayDropdown();

Return Type

None

setConfigsFromParent Method

This method is used when the Dropdown component is placed inside another component. The setConfigsFromParent method is used to set the configurations from the parent component to the Dropdown component.

Parameter Value

Syntax

this.view.<componentID>.setConfigsFromParent(configParams);

Input parameter

configParams: Sets the JSON object required for the child component. The JSON object can contain all the contracts used in the Carousel card component as keys such as:

  • serviceParameters: JSON object containing the Service configurations.
  • dataMapping: JSON object containing the data mapped with the widget.
  • dataFormatting: JSON object containing the look and feel of the data.

Sample Input

var configParams = {
	"serviceParameters": "this.__dropdownServiceParameters",
	"dataMapping": "this.__dropdownDataMapping",
	"dataFormatting": "this.__dropdownDataFormatting"
};
this.view.dropdown.setConfigsFromParent(configParams);

Return Type

None

setDropdownData Method

This method helps to execute events like preShow or postShow. The setDropdownData method must be invoked when a developer initializes the Dropdown component dynamically.

Parameter Value

Syntax

this.view.<ComponentID>.setDropdownData();

Input parameter

NA

Sample Input

this.view.dropdown.setDropdownData();

Return Type

None

updateDefaultSelection Method

This method sets a default row selection at run-time.

Parameter Value

Syntax

this.view.<ComponentID>.updateDefaultSelection();

Input parameter

defaultSelectionConfig: JSON object containing the key-value pairs for the default row selection.

Sample Input

var defaultSelectionConfig = {
	"key": "countryId",
	"value": "5"
};
this.view.dropdown.updateDefaultSelection(defaultSelectionConfig);

Return Type

None

Context Object

The context object is a JSON object that is used as an input in the Dropdown Component containing the data to be displayed in the component.

Out of the response provided, the following parameters are used in the component.

  • mainHeaderTitle
  • sectionHeaderTitle
  • records

Here is a sample of the Context JSON Object used inside the component.

var context = {
	"mainHeaderTitle": "Country Code",
	"sectionHeaderTitle": "Please select a country code",
	"records": [{
			"countryId": "1",
			"countryFlag": "usa.png",
			"countryName": "USA",
			"countryCode": "US (+1)"
		},
		{
			"countryId": "2",
			"countryFlag": "spain.png",
			"countryName": "Spain",
			"countryCode": "ES (+34)"
		}
	]
};

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 2, 2022 5:08:52 PM IST

Feedback
x