npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nativescript-telerik-reporting

v1.0.3

Published

A helper library for accessing Telerik Reporting REST API

Downloads

3

Readme

Build Status npm downloads npm downloads npm

A NativeScript plugin for easy access to Telerik Rporting REST API.

Installation

Run the following command from the root of your project:

tns plugin add nativescript-telerik-reporting

This command automatically installs the necessary files, as well as stores nativescript-telerik-reporting as a dependency in your project's package.json file.

Configuration

There is no additional configuration needed!

API

ReportingClient

Methods

  • constructor(ReportingClientOptions)
    Creates a reporting client instance with the given serverUrl. Note this should be the root of your site where you host the REST service and should not include /api/reports in it.
    Also you can send additionalHeaders which will be sent with every request. Useful for sending authentication in case your reporting service requires authentication.
  • getAvailableDocumentFormats(): Promise<DocumentFormat[]>
    Gets an array of supported document export formats by the server. This method can be called without registering the client. (API Reference)
  • register(): Promise
    Registers the client with the server. (API Reference)
  • unregister(): Promise
    Unregisters the client from the servers. You need to call this once you finished using the reporting client so it can free up resources on the server. (API Reference)
  • getReportParameters(ReportSource): Promise<ReportParameter[]>
    Gets info about the parameters for the given reports. Also can be used to check the validity of the given parameters for the given report. (API Reference)
  • createInstance(ReportSource): Promise
    Creates a ReportingInstance that can be used to render and download reports from the server. (API Reference)

ReportingInstance

Methods

  • createDocument(DocumentFormatKey): Promise
    Creates a ReportingDocument with the given export format. (API Reference)
  • destroy(): Promise
    Destroys the reporting instance from the server. It is important to call this method once you finish your work so it can free the resources on the server. (API Reference)

ReportingDocument

Methods

  • getInfo(): Promise
    Gets info about the rendered report document, for example if it is ready on the server, how many pages it has, etc.(API Reference
  • download(File?): Promise
    Downloads the prepared document from the server. By default it names the file with documentId adds an appropriate extension and saves the file in the device specific temp folder. In case you need to save the file somewhere else, or need to name it differently you can send a File instance to this method.
  • getPage(number): Promise
    Gets information about the given page. (API Reference)
  • destroy(): Promise
    Destroys the reporting document from the server. It is important to call this method once you finish your work so it can free the resources on the server. (API Reference)

Usage

A typical usage scenario is when you want to generate a report on your server and the download the file in an appropriate format (for example a PDF document). Below is an example how you can make this. You start by creating a client with your server's URL. Then you register your client, create an instance and a document. Finally you download the document to the mobile device.

const req: ReportSource = {
    report: "Telerik.Reporting.Examples.CSharp.Invoice, CSharp.ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
    parameterValues: {
        OrderNumber: "SO51081",
        ForYear: 2003,
        ForMonth: 7,
    },
};
const reportingClient = new ReportingClient({ serverUrl: "https://....." });
reportingClient.register()
    .then(() => reportingClient.createInstance(req))
    .then((instance) => {
        instance.createDocument({ format: documentFormat } as any).then((document) => {
            document.download().then((file) => {
                utils.ios.openFile(file.path);
                viewModel.set("isBusyIn", false);

                document.destroy()
                    .then(() => instance.destroy())
                    .then(() => reportingClient.unregister);
            });
        });
    });

It is really important to remember to call destroy() for your instances and documents and to unregister() your client as this frees up resources on the server. Also it is a good idea to reuse clients/instances whenever possible.

Demos

This repository plain NativeScript demo. In order to run those execute the following in your shell:

$ git clone https://github.com/peterstaev/nativescript-telerik-reporting
$ cd nativescript-telerik-reporting
$ npm install
$ npm run demo-ios

This will run the plain NativeScript demo project on iOS. If you want to run it on Android simply use the -android instead of the -ios sufix.

Donate

Donate

bitcoin:14fjysmpwLvSsAskvLASw6ek5XfhTzskHC

Donate