Skip to main content Skip to complementary content

getData method

getData(qPages)

Method used to get data from Qlik engine for this object.

Since:
  • 1.0

Parameters

Name Type Description
qPages Array An array of NxPage objects.

Returns

Returns a promise of qDataPages.

Tip noteFor more information regarding a promise, see http://docs.angularjs.org/api/ng.$q.

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 );
               } );
     }
 
}

Learn more

 

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!