Skip to main content Skip to complementary content

Selection API

Information noteIf you are using Qlik Sense Business or Qlik Sense Enterprise SaaS, see the API documentation at the Qlik (Developer Portal).
Information noteSTABLE.

This API is reliable and breaking changes are unlikely.

qlik.app.selectionState()

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.

Version history

Each method and property contain information around when it was introduced, updated, deprecated or removed. A list of all relevant API changes per version release can be found in API version history.

Version history
Version state Details
Introduced 2.2

Getting started

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

var config = {
	host: 'QSE_domain',
	prefix: '/',
	port: 443,
	isSecure: true,
	webIntegrationId: 'web-integration-id-here' //only needed for SaaS editions
};
require(["js/qlik"], function(qlik) {
  //open apps -- inserted here --
  var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);

  var selState = app.selectionState( );
  var listener = function() {
    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 Global 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>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!