jsreports : object

Kind: global namespace

jsreports.libraryPath

Kind: static property of jsreports
Access: public
Properties

Name
libraryPath

jsreports.export(options)

Export a report directly to file.

Kind: static method of jsreports

Param Type Description
options object Configuration object with the following options
options.report_def object Report definition object (or JSON string)
options.datasets array Array of data source definitions available for the report
options.format string Output format; one of "pdf", "xlsx"
options.filename string The filename to use when downloading. Defaults to the report title.
[options.customFunctions] object The filename to use when downloading. Defaults to the report title.
[options.imageUrlPrefix] string Prefix to prepend to all image URLs in the report
[options.outputHandler] function Function that will receive the binary output data instead of downloading via the browser

jsreports.getDatasets()

Return the current data sources, including any loaded data.

Kind: static method of jsreports

jsreports.getReportDefinition()

Return the currently edited report definition object.

Kind: static method of jsreports

jsreports.getSchemas()

Return the current data source schemas.

Kind: static method of jsreports

jsreports.registerFont(family, weight, style, url)

Register a font face (a family, and optionally weight and style) for PDF font embedding.

Kind: static method of jsreports

Param Type Description
family string The font family, e.g. Helvetica
weight string The font weight, one of "normal" or "bold"
style string The font style, one of "normal" or "italic"
url string The url of the font's .ttf file

jsreports.registerFontReference()

Enable references to a font by font name in PDF without embedding the font file. WARNING: This will result in unpredictable results when the PDF is viewed on systems that do not contain the named font. Unless there is a good reason, you should use registerFont instead to embed an actual font file in the resulting PDF.

Kind: static method of jsreports
Example

jsreports.registerFontReference('Comic Sans');

jsreports.render(options)

Render a report into an HTML element on the page.

Kind: static method of jsreports

Param Type Default Description
options object Configuration object with the following options
options.report_def object JavaScript object representing a jsreports report definition, or a JSON string that can be parsed into such an object.
options.datasets array JavaScript array defining the data sources that can be used by the report. Any data source referenced by the report definition must be present in this array.
options.target DOMElement The target DOM element into which the report will be rendered
[options.showToolbar] boolean true Whether to show the report toolbar (default: true)
[options.imageUrlPrefix] string Prefix to prepend to all image URLs in the report

jsreports : object

Kind: global namespace

jsreports.Designer

A drag-and-drop report designer component.

Kind: static class of jsreports

new jsreports.Designer(options)

Param Type Description
options Object
[options.reportDef] string The report definition object to edit. If not provided, the designer will be empty.
options.dataSources Array Array of configuration objects for the available data sources for reports.
options.images Array Available images that can be used by the report. Each array element should contain the following properties:
name (String) A description of the image
url (String) The location of the image
options.embedded boolean True to embed the designer in an element on the page (requires container config). False to show designer in a popup. Default: false.
options.container HTMLElement When embedded is true, the element into which to render the designer.
options.toolbarPosition string Controls where the toolbar for editing elements appears. Options:
top - Appears above report canvas
bottom - Appears below report canvas
float - Appears floating just below the selected element
Default: top

Example

var designer = new jsreports.Designer({
    data_sources: [ ... ],
    report_def: { ... },
    images: [ ... ],
    toolbarPosition: "top",
    embedded: true,
    container: $("#reportDesigner")
});

designer.dataPaneHeight

User-supplied function returns true if it handles the event and we don't

Kind: instance property of Designer

designer.addConditionalPropertiesButtonToToolbar()

Takes the template div for jqtoolbar (for example, the one returned by create_text_toolbar) and adds the template item for the conditional properties button. This button will need to be bound to the actual toolbar instance via bindConditionalPropertiesButton().

Kind: instance method of Designer

designer.fit_section()

Increase section height if needed to contain its elements. Returns whether or not the section height was changed.

Kind: instance method of Designer

designer.getDataSectionFromGroupingControl()

Helper fn to find data section owning a grouping input

Kind: instance method of Designer

designer.getJasperReport() ⇒ Object

Kind: instance method of Designer
Returns: Object - The current Jasper report definition object when in Jasper mode
Access: public

designer.getMinDefaultSectionHeight()

The minimum height to apply when making a section visible again via a checkbox

Kind: instance method of Designer

designer.getReport() ⇒ Object

Kind: instance method of Designer
Returns: Object - The current active report definition object, possibly unsaved, possibly null if none loaded
Access: public

designer.getSchemaForDataSection()

Expects dataSection def (raw body definition object)

Kind: instance method of Designer

designer.getSchemaForSectionEntry()

From a section entry wrapper object (visible section in template rendering), get the data source schema for that section. Check upward from a detail section or sub-level (group header/footer) to the first non-inherited data source (non-"__parentgroup").

Kind: instance method of Designer

designer.getSelectedElementContext()

Get context about how the element is situated within the report (available data sources, etc) to pass to the element class to generate its toolbar options

Kind: instance method of Designer

designer.onElementEvent()

Called by element instances when they raise an event

Kind: instance method of Designer

designer.renderDataSectionControls()

Render the left-side config controls for a single data section (inside accordion)

Kind: instance method of Designer

designer.setReport()

Kind: instance method of Designer
Access: public

"save"

Save event.

Kind: event emitted by Designer
Properties

Name Type Description
reportJson boolean JSON string containing report definition