Skip to content

bind

This function allows you to bind to a given report event and wire up a callback.

Syntax

bind (event, callback)

Arguments

event : string (required)

The name of the Report Event to be bound.

callback : function (required)

The JavaScript function that will be called when the event is triggered.

Example

report.api.bind("postrender", function(){
    // Call off to the server via the API to calculate a report
    var calcId = report.api.getCalculationId("Report2"); 

    // Use the id of that calculation and get cells A1:F40 from it as an array of values
    var values = report.api.getValues("A1:F40", calcId);

    // At this point we have an array of values
    // We could do many things with them, such as
    //   * Feed them into a JavaScript charting library
    //   * Update some data on this report 
    //   * Display the data in some way on this report.
});
Back to top