Keyword Search

Overview

The Keyword Search component uses this text and modifies it based on the parameters (such as character length and restricted character list) set by the developer and passes the modified text to the parent form or component controller.

The Keyword Search component also provides the following options.

  • Cancel the search.
  • Clear the user entered text in the search input box.

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

Keyword Search Contracts

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

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, i18n keys, text, and the response data to the various keys. Data Collection Object, Context variable, or Service response provides the response data for mapping.

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"
		}
	},
	"searchWithCancelView": true,
	"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 cannot enter in the search input box.
  • maxCharacters: Sets the maximum number of characters the user can enter 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.
searchWithCancelView
  • Accepts a Boolean value.
  • • When the value of this key is true, a Cancel button appears when the user initiates the search using the component.
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 to be executed when an 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);

onSearch Event

The onSearch event is invoked when the user clicks the Search button inside the component. The event passes the user entered text to the parent widget in a String format. The text is formatted as per the characters that are restricted and maximum characters that are set.

Parameter Value
Input parameter
  • SearchText: The text entered by the user.
Programmatic Name onSearch

Sample Code

this.onSearch(SearchText);

Return Type

None

onCancel Event

The onCancel event is triggered when the user clicks the Cancel button. This event passes the user entered text to the parent widget.

Parameter Value
Input parameter
  • SearchText: The user entered text.
Programmatic Name onCancel

Sample Code

this.onCancel(SearchText);

Return Type

None

setContext Method

This method is invoked inside the parent component or form controller. This method is used to pass a text used to the input box in place of the entry in the input box.

Parameter Value

Syntax

this.view.componentID.setContext(SearchText);

Input parameter
  • SearchText: The user entered text.

Sample Input

this.view.keywordSearch.setContext(SearchText);

Return Type

None

setConfigFromParent Method

This method is used to set the configurations from the parent component to the List component when the Keyword Search component is placed inside another component.

Parameter Value

Syntax

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

Input parameter

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

  • 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.
  • conditionalMappingKey: JSON object containing the key for setting the conditional criteria.
  • conditionalMapping: JSON object containing the look and feel of the data as per the conditional criteria.

Sample Input

var configParams = {
	"serviceParameters": "this._keywordSearchServiceParameters",
	"dataMapping": "this._keywordSearchDataMapping",
	"dataFormatting": "this._keywordSearchDataFormatting",
	"conditionalMappingKey": "this._keywordSearchConditionalMappingKey",
	"conditionalMapping": "this._keywordSearchConditionalMappingKey"
};
this.view.keywordSearch.setConfigsFromParent(configParams);

Return Type

None

resetSearchView Method

This method resets the component to display the initial view of the search using the values set in the Data Mapping contract by default.

Parameter Value

Syntax

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

Input parameter

NA

Sample Input

this.view.keywordSearch.resetSearchView();

Return Type

None

setSearchFocus Method

This method enables the input field's focus when the soft keypad is open.

NOTE: As per the native platform behavior, the setFocus method works only in the postShow event of the parent form or the Component controller.

Parameter Value

Syntax

this.view.<ComponentID>.setSearchFocus(value);

Input parameter
  • value: Boolean value to enable or disable the focus.

Sample Input

this.view.keywordSearch.setSearchFocus(true);

Return Type

None

setKeywordSearchData Method

This method re-initializes the component dynamically at runtime. To re-initialize, the setKeywordSearchData method invokes the preShow event of the component.

Parameter Value

Syntax

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

Input parameter

NA

Sample Input

this.view.keywordSearch.setKeywordSearchData();

Return Type

None

Copyright © 2020- Temenos Headquarters SA

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

Feedback
x