backbone.jshighchartspentahodrilldownsaiku

Saiku query fetch


I'm new to saiku and backbone. I'm trying to figure out how ChartPlus highcharts work in Saiku and have integrated Saiku in Pentaho. I have downloaded the source code, been going through the code and trying to figure out how the database is being hit to generate the charts. I found the below event for fetching the query but unable to find where it is defined and how it is getting called.

   this.workspace.trigger('query:fetch');

Can anyone help out by telling how this works?


Solution

  • You can install Saiku CE and Saiku Chart Plus using Pentaho Marketplace or you can build the Saiku source and put in folder in pentaho-solutions and restart server.

    The code that you spoke, you can see the event created here: https://github.com/OSBI/saiku/blob/master/saiku-ui/js/saiku/models/Query.js#L135

    Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks.

    You could catch it using:

    var MyClass = Backbone.View.extend({
      initialize: function(args) {
        // Keep track of parent workspace
        this.workspace = args.workspace;
    
        // Maintain `this` in callbacks
        _.bindAll(this, 'receive_data', 'workspace_levels');
    
        // Listen to result event
        this.workspace.bind('query:fetch', this.receive_data);
      },
    
      receive_data: function(args) {
        console.log(args);
      },
    });