Page 1 of 1

How to call Save function programmatically in designer?

Posted: Wed Sep 20, 2017 8:28 am
by titanotam
Hi,

My report designer has these options:

Code: Select all

this.options.toolbar.showFileMenu = false;
this.options.toolbar.showSaveButton = false;
... and I create a custom Save button but don't know how to call the save report function programmatically.

Someone please help me :)

Thanks

Re: How to call Save function programmatically in designer?

Posted: Thu Sep 21, 2017 2:29 pm
by Alex K.
Hello,

You can use the following code:

Code: Select all

var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
          var customButton = document.getElementById("customButton");
          customButton.onclick = function () {
                designer.jsObject.SendCommandSaveReport();
            }
Thank you.

Re: How to call Save function programmatically in designer?

Posted: Mon Sep 25, 2017 10:50 am
by titanotam
Aleksey wrote:Hello,

You can use the following code:

Code: Select all

var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
          var customButton = document.getElementById("customButton");
          customButton.onclick = function () {
                designer.jsObject.SendCommandSaveReport();
            }
Thank you.
Nice! Thank a lot ;)

Re: How to call Save function programmatically in designer?

Posted: Mon Sep 25, 2017 12:04 pm
by Alex K.
Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.

Re: How to call Save function programmatically in designer?

Posted: Wed Feb 07, 2024 2:51 am
by fridaystreet
Hi,

trying to do this but we get the error

Cannot set properties of undefined (setting 'reportIsModified')

Any ideas? do we need to pass something to the command?

Cheers

Re: How to call Save function programmatically in designer?

Posted: Wed Feb 07, 2024 3:01 am
by fridaystreet
bit further debugging and looks like options inside the designer object is undefined

error is caused by options not being defined at 'this.options.reportIsModified = !1'

stimulsoft.designer.js

Code: Select all

.SendCommandSaveReport = function(e, t) {
        var o, i, a, o;
        this.options.reportIsModified = !1,
        this.options.haveSaveEvent ? (o = {
            command: "SaveReport",
            reportFile: this.options.report.properties.reportFile,
            isNewReport: e,
            autoSave: t
        },

Re: How to call Save function programmatically in designer?

Posted: Wed Feb 07, 2024 3:02 am
by fridaystreet
this is how we are generating the designer. at which point report has already been generated before it is assigned via 'newDesigner.report = report'

Code: Select all

const options = new window.Stimulsoft.Designer.StiDesignerOptions()
    options.Height = '100%'
    options.Width = '100%'
    options.appearance.allowChangeWindowTitle = false
    options.appearance.zoom = 'PageHeight'
    options.appearance.showSaveDialog = false
    options.appearance.fullScreenMode = true
    options.toolbar.showSaveButton = false
    options.toolbar.showFileMenuNewReport = true
    options.toolbar.showFileMenuNewDashboard = false
    options.toolbar.showFileMenuNew = true
    options.toolbar.showNewDashboardButton = false
    options.toolbar.showFileMenuOpen = true
    options.toolbar.showFileMenuClose = false
    options.toolbar.showFileMenuSaveAs = true
    options.toolbar.showFileMenuSave = false

    if (dashboardMode) {
      options.toolbar.showFileMenuNewDashboard = true
      options.toolbar.showFileMenuNewReport = false
      options.toolbar.showNewDashboardButton = true
      options.toolbar.showNewPageButton = false
      options.toolbar.showFileMenuReportSetup = false
      options.bands.showReportTitleBand = false
      options.bands.showReportSummaryBand = false
      options.bands.showPageHeaderBand = false
      options.bands.showPageFooterBand = false
      options.bands.showTableOfContents = false
    }

    for (const option in savedOptions) {
      options[option] = {
        ...options[option],
        ...savedOptions[option]
      }
    }

    const newDesigner = new window.Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false)
    newDesigner.onSaveReport = onSaveReport
    newDesigner.onBeginProcessData = onBeginProcessData
    newDesigner.onExit = onExit
    newDesigner.report = report
    
    
    

Re: How to call Save function programmatically in designer?

Posted: Wed Feb 07, 2024 9:54 am
by Lech Kulikowski
Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.