getData method
Information noteSTABLE.
This API is reliable and breaking changes are unlikely.
This API is reliable and breaking changes are unlikely.
backendApi.getData(qPages)
Gets data from Qlik associative engine for this object.
Version history
Version state | Details |
---|---|
Introduced | 1.0 |
Parameters
qPages
Type: Array
An array of NxPage objects.
Returns
A promise of qDataPages.
Tip noteFor more information regarding a promise, see The Promise API.
Examples
Example:
var self = this, requestPage = [{
qTop : i + this.currpos,
qLeft : 0,
qWidth : 10,
qHeight : this.displayrows
}];
this.backendApi.getData(requestPage).then(function(dataPages) {
self.paint($element);
});
Example:
In this example, the getData function get the cells defined by requestpage and returns them in the parameter dataPages. It also updates the layout buffer used by eachDataRow, so when the paint function is called again it will have all rows. This way, the visualization is build up gradually.
paint: function ( $element ) {
var lastrow = 0, me = this;
//loop through the rows we have and render
this.backendApi.eachDataRow( function ( rownum, row ) {
lastrow = rownum;
//do something with the row..
});
if(this.backendApi.getRowCount() > lastrow +1){
//we havent got all the rows yet, so get some more, 1000 rows
var requestPage = [{
qTop: lastrow + 1,
qLeft: 0,
qWidth: 10, //should be # of columns
qHeight: Math.min( 1000, this.backendApi.getRowCount() - lastrow )
}];
this.backendApi.getData( requestPage ).then( function ( dataPages ) {
//when we get the result trigger paint again
me.paint( $element );
} );
}
}