Skip to main content Skip to complementary content

Accessing visualization data

The getObject method allows you to inject a Qlik Sense visualization into a HTML element on your web page. You can also access the data of the visualization.

The getObject method returns a promise that, when the data has been received from the Qlik associative engine,resolves with an object model. This model will have the same layout structure that the visualization uses for rendering.

Example:  

app.getObject( elementid, id).then( function ( model ) {
	//model.layout will contain the data
	//do we have a title??
	if(model.layout.title){
		alert(model.layout.title);
	}
} );

Notifications when data changes

The model you receive when the promise resolves contains the initial data, used when the visualization is displayed the first time. The data is recalculated when selections are made. If you want to be notified when this occurs, you can use the validated event. It will be triggered whenever there are new valid data available.

Available events

Validated

The data has been recalculated and new valid data is available.

Invalidated

The data has been invalidated, for example by a user selection. Do not use the data.

Aborted

Calculation has been aborted.

Cancelled

Calculation has been cancelled.

Closed

Connection to the Qlik associative engine has been closed for this object.

Example

function setTitle ( model, elemid ) {
	//have we got a title??
	if ( model.layout.title ) {
		//set the text of all links to this element to the title
		$( 'a[href="#' + elemid + '"]' ).html( model.layout.title );
	}
}


app.getObject( elementid, id).then( function ( model ) {
	//set the title
	setTitle( model, elementid);
	//bind to validated event
	model.Validated.bind( function () {
		//will be triggered when there is new data
		setTitle( this, elementid);
	} );
} );

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!