Table API
This API is reliable and breaking changes are unlikely.
qlik.table
The Table API allow developers to work with tabular data returned from the Qlik associative engine without having deeper knowledge of internal constructs, like for example a Hypercube.
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.
Version state | Details |
---|---|
Introduced | 2.1 |
Getting started
The qlik.app.createTable method is the entry point to the Table API. It creates a table object that wraps the hypercube. A table object of type QTable is returned. It is initially empty but will eventually contain data. The table object will be updated when selection state changes. Notification is sent when data is available and will be triggered after each update. To receive notification bind a listener on OnData of QTable instance.
var table = qlik.table( this );
var listener = function() {
var rowCount = table.rowCount;
var colCount = table.colCount;
table.OnData.unbind( listener ); //unregister the listener when no longer notification is needed.
};
table.OnData.bind( listener ); //bind the listener
if ( !this.$scope.table ) {
this.$scope.table = qlik.table( this );
}
<tr ng-repeat="row in table.rows">
<td ng-repeat="cell in row.cells"> {{cell.qText}} </td>;
</tr>
Examples of use
Learn what you can do with the Table API.
Export the hypercube
Example 1:
This example creates a button that exports the entire hypercube data when pressed.
var qTable = qlik.table(this);
var $exportButton = $( document.createElement('button'));
$exportButton.html('Export');
$exportButton.bind('click', function ( ) {
qTable.exportData({download: true});
});
$element.append($exportButton);
Example 2:
This example is using AngularJS in a visualization extension
...
paint: function ( ) {
//setup scope.table
if ( !this.$scope.table ) {
this.$scope.table = qlik.table( this );
}
}
...
<button ng-click="table.exportData({download:true})">Create Excel file</button>
Get more hypercube data
This example gets more data for your hypercube and is based on using AngularJS in a visualization extension.
...
paint: function ( ) {
//setup scope.table
if ( !this.$scope.table ) {
this.$scope.table = qlik.table( this );
}
}
...
<button ng-if="data.rowcount>data.rows.length" ng-click="data.getMoreData()">More</button>