Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.


App API and Viz API noSelections option

Sometimes you may want to use a chart in a mashup that does not allow selections. Before Qlik Sense 3.0, you basically had three options. One of those options I blogged about before Disable selections in charts using Capability APIs. With this approach, you basically locked the field used in the chart to not allow any selections on that field. This had the side effect of not allowing a selection on that field anywhere in the mashup. The other two options were very similar. You could "mask" the chart with a div that sat over top of the chart, or you could use the noInteraction option that basically did the same thing. The problem with these approaches was that you could not scroll the chart or see the tooltips.

A better solution

Introduced with Qlik Sense 3.0, the noSelections option is a much better solution to this problem than any that previously existed. It disallows selections in the chart, without affecting the tooltips, ability to scroll, or the field used in the chart. And it's really easy to use.

Using noSelections option with the App API

To use the noSelections option with the getObject() method of the App API, simply set it in the options parameter like below

app.getObject(<htmlElement>, <objId>, {noSelections: true});

It's really that simple.

Using the noSelections option with the Visualization API

Using the noSelections option with the Visualization API is just a tiny bit trickier. I didn't realize I could even do it at first, because it's a little buried in the docs. But all you have to do is set the noSelections option in the options parameter of the show() method, like below.

qlik.app.visualization.create(type, cols, options).then(function(viz) {

viz.show(<htmlElement>, {noSelections: true});


And that's it. I find that this can often be really useful, because many there are many use cases where I want to embed just a chart or two into a page, and it makes no sense to allow selections on those charts, and now that we have the noSelections option is definitely the best way of accomplishing this.