Skip to content

Get started with the Selection API

Note: Where possible, use qlik-embed and qlik/api rather than this framework.

The Selection API is the external interface to Qlik Sense selection state data and it allows developers to work with selection state data returned from the Qlik associative engine without having deeper knowledge of internal constructs.

The qlik.app.selectionState method is the entry point to the Selection API. It creates a QSelectionState object that encapsulates the selection state.

const config = {
  host: '<TENANT_URL>',
  prefix: '/',
  port: 443,
  isSecure: true,
  webIntegrationId: '<WEB_INTEGRATION_ID>'
};
require(["js/qlik"], (qlik) => {
  //open apps -- inserted here --
  const app = qlik.openApp('<APP_ID>', config);

  const selState = app.selectionState( );
  const listener = () => {
    alert('Back count:' + selState.backCount);
    selState.OnData.unbind( listener );
  };
  selState.OnData.bind( listener );

selectionState method

Examples of use

Learn what you can do with the Selection API.

Example based on AngularJS

Main script:

 $scope.selState = app.selectionState( );

AngularJS template:

<button type="button" class="btn btn-default btn-xs" 
ng-click="selState.clearAll()" aria-label="Clear">
  <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>

<li ng-repeat="sel in selState.selections">{{sel.fieldName}}: {{sel.qSelected}}
  <button type="button" class="btn btn-default btn-xs" 
  ng-click="sel.field.clear()" aria-label="Lock">
    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
  </button>
</li>
Was this page helpful?