Skip to main content Skip to complementary content

QSelectionState

Information noteSTABLE.

This API is reliable and breaking changes are unlikely.

Class

QSelectionState()

Selection state object returned for the selection state created with the selectionState method.

The selectionState interface is the external interface to Qlik Sense selection state data. It allows developers to work with the selection state data returned from Qlik associative engine without having a deeper knowledge of internal constructs.

Notification is sent when data is available and notification is triggered after each update.

Information noteTo receive a notification, bind a listener on OnData for the QSelectionState instance.

Version history

Version history
Version state Details
Introduced 2.2

Properties

stateName

Type: String

State name. $ for default state.

selections

Type: Array.QFieldSelections

Selections.

backCount

Type: Number

Number of back steps available.

forwardCount

Type: Number

Number of forward steps available. OnData notification will be triggered after each update.

Examples

Example 1:  

// create an object
var selState = app.selectionState( );
var listener = function() {
	alert('Back count:' + selState.backCount);
	//unregister the listener when no longer notification is needed.
	selState.OnData.unbind( listener );
};
//bind the listener
selState.OnData.bind( listener );

Example 2: Using 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!