Skip to main content Skip to complementary content

Creating extensions on the fly

The registerExtension method allows you to register a visualization extension in a mashup without installing it on the Qlik Sense server. After it has been registered, it is free to use within the mashup just as if it was installed on the server. This means that you can distribute mashups, including the extensions being used, as one package.

General workflow

This is the general workflow for creating extensions on the fly in mashups.

  1. Configure requireJS.
  2. Include the Qlik Sense CSS files.
  3. Create a new extension or copy an existing extension into your mashup folder.

    You can also create a new extension inline.

  4. Load the extension and register it using the registerExtension function.

    If the extension is created in separate folder, it must be loaded with reguireJS.


// The path to the location of the mashup 
var path = window.location.href.substr( 0, location.href.lastIndexOf( "/" ) );
require( [path + "/myextension/myextension.js"], function ( myextension ) {
	qlik.registerExtension( 'myextension', myextension );
} );

Hello world on the fly

This example creates and registers a basic hello world extension in the mashup.

//define the helloworld extension
var helloworld = {

		paint: function ($element) {
			$element.html( "Hello world!!" );
//register the extension
qlik.registerExtension( 'helloworld', helloworld );
var app = qlik.openApp( 'app file name or ID', config );
//create and show an object using the extension
app.visualization.create( 'helloworld', ["Case Owner Group"] ).then( function ( helloworld ) { "QV00" );
} );

Toolbar extension on the fly

This example registers an existing toolbar extension for the Helpdesk Management app. It also defines one dimension and one measure.

Locations of the toolbar extension and associated CSS file used in this example:

  • Qlik Sense Desktop: C:\Users\bll\Documents\Qlik\Examples\Extensions\ToolBar
  • Qlik Sense Enterprise on Windows: C:\ProgramData\Qlik\Examples\Extensions\ToolBar

The extension is loaded with requireJS and the path to the extension is defined.

var path = mashup_path; // The path to the location of the mashup For example, "" for a mashup hosted on an external domain.
require( ["js/qlik", path + "/toolbar/com-qliktech-toolbar.js"], function ( toolbar ) {
	var app = qlik.openApp( 'app file name or ID', config );
	qlik.registerExtension( 'toolbar', toolbar );
	app.visualization.create( 'toolbar', null,
			"title": "On the fly toolbar", 
	).then( function ( toolbarobj ) { 'QV05' );
	} );
} );

Example code output:

An on the fly toolbar.

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!