Accessing the "configuration" Contract

As a prerequisite, you have to consume the configuration contract and declare names for all configuration parameters in the CHIP definition XML. Optionally, you can also define default values for the configuration parameters.

The configuration property is then available in the CHIP API object. It provides the method chip.configuration.getParameterValueAsString(), which allows you to read parameters that have been declared in the CHIP definition XML.

Example: Code Example

var oChipApi = this.getView().getViewData().chip,
  sConfigurationValue = oChipApi.configuration.getParameterValueAsString("parameterName");

Example: Example for Configuration

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2012 SAP AG, All Rights Reserved -->
<chip xmlns="http://schemas.sap.com/sapui2/services/Chip/1">
  <implementation>
    <sapui5>
      <viewName>sap.ui2.chips.sample.links.Links.view.xml</viewName>
    </sapui5>
  </implementation>
  <appearance>
    <title>Link List Sample Chip</title>
  </appearance>
  <contracts>
    <consume id="configuration">
      <parameters>
        <parameter name="columns">3</parameter>
        <parameter name="id"></parameter>
        <parameter name="showChildren">true</parameter>
      </parameters>
    </consume>
    <consume id="fullscreen" />
    <consume id="navigation" />
    <consume id="refresh" />
    <consume id="url" />
  </contracts>
</chip>