Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
how i can restrict the export in html reporting ?
posted

Hi, i have a problem with export the reports, i´d like restrict the export, but i don't know what property i must use. i'll be very happy if you help me to resolve this problem.

Parents
No Data
Reply
  • 2671
    Suggested Answer
    Offline posted

    Hello Juan,

    As far as I understand by restricting you want to either control or prevent exporting of reports. I see a few options for this:

    1. As simple as disabling the toolbar if that fits your need "createToolbar : false". You can always provide any required functionality from an external UI/interaction using the igReportViewer API. If that isn't an option below are more fine-grain control options:


    2. Remove only the export button (API method is still available). Easiest way is to remove it right at firstPageAvailable event:

    1. $("#report2").on("firstPageAvailable", function (evt, args) {
    2.     //remove the export button
    3.     $("#report2 .buttonExport").remove();
    4. });

    3. Disable the button. You actually have to keep it disabled as the viewer checks multiple times if export is possible and re-enables it. That way you can easily enable it again at some point:

    1. $("#report2").on("processingCompleted printStarted printFinished", function (evt, args) {
    2.     // keep the export button disabled untill needed
    3.     $("#report2 .buttonExport").button("disable");
    4. });

    4. Conditionally prevent exports - this is good for when you need to check user rights or some other condition. Use the "exportStarted" event and cancel it as you see fit:

    1. $("#report1").on("exportStarted", function (evt, args) {
    2.     //cancel export based on some condition:
    3.     if (!canExport.checked) {
    4.         $("#report1").igReportViewer("cancelExport");
    5.     }
    6. });

    I've attached a sample you can try these on. Let me know if this was helpful.

    Regards,

    Damyan

    ReportingHTMLViewer.zip
Children
No Data