Selection API

Note: STABLE.
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

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: "myhost.com",
	prefix: "/",
	port: window.location.port,
	isSecure: true
};
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

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.

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 information help you?

Can you tell us why it did not help you and how we can improve it?