getData method

Note: STABLE.
This API is reliable and breaking changes are unlikely.

backendApi.getData(qPages)

Gets data from Qlik associative engine for this object.

Version history

Introduced 1.0

Parameters

qPages

Type: Array

An array of NxPage objects.

Returns

A promise of qDataPages.

Tip: For more information regarding a promise, see https://code.angularjs.org/1.7.0/docs/api/ng/service/$q#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 );
               } );
     }
 
}

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?