Various questions about designer

Stimulsoft Reports.JS discussion
Post Reply
petervandeput
Posts: 3
Joined: Wed Feb 10, 2021 9:52 am

Various questions about designer

Post by petervandeput »

We are integrating this in our system which is Ruby on Rails.
We need users to create a data source (Postgres) and on server side we do the mapping to physical DB with secured credentials.
therefore we need to make some customizations.

1. is it possible to customize the list of available datasources? e.g. only display PostgresSQL
2. how is it possible in the designer to customize the page rendered with File --> New
a. remove Help and About link
b. New only showing new Blank Report or Blank Dashboard
c. we save the report definition in our backend DB, how can we customize the save prompt to not be report.mrt?

3. Want to display a graph with daily sales for the past year by date so series is date (365 items) and value is sales_amount
screen is full with the date labels and line is not rendered. How can i add date as series and not show it in the legend?
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Various questions about designer

Post by Lech Kulikowski »

Hello,

> 1. is it possible to customize the list of available datasources? e.g. only display PostgresSQL

Yes, it is possible:

Code: Select all

        // Override the list of supported databases
        StiOptions.Services._databases = new Stimulsoft.System.Collections.List();
        StiOptions.Services._databases.add(new Stimulsoft.Report.Dictionary.StiFirebirdDatabase());
        StiOptions.Services._databases.add(new Stimulsoft.Report.Dictionary.StiMySqlDatabase());
        StiOptions.Services._databases.add(new Stimulsoft.Report.Dictionary.StiSqlDatabase());
> 2. how is it possible in the designer to customize the page rendered with File --> New
a. remove Help and About link
b. New only showing new Blank Report or Blank Dashboard
c. we save the report definition in our backend DB, how can we customize the save prompt to not be report.mrt?

You can set the designer toolbar settings:
https://www.stimulsoft.com/en/documenta ... ttings.htm

> 3. Want to display a graph with daily sales for the past year by date so series is date (365 items) and value is sales_amount
screen is full with the date labels and line is not rendered. How can i add date as series and not show it in the legend?

Please provide more detailed information. Please send us a test data and the necessary result, we will try to prepare sample.

Thank you.
petervandeput
Posts: 3
Joined: Wed Feb 10, 2021 9:52 am

Re: Various questions about designer

Post by petervandeput »

Image
How can this be achieved?
Attachments
1.png
1.png (648.53 KiB) Viewed 920 times
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

Re: Various questions about designer

Post by Lech Kulikowski »

Hello,

You can use the following code:

Code: Select all

var options = new Stimulsoft.Designer.StiDesignerOptions();
var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
designer.renderHtml("content");
           
//Initialize New Report Panel
var newReportPanel = designer.jsObject.options.newReportPanel || designer.jsObject.InitializeNewReportPanel();

//Add custom image to collection
designer.jsObject.options.images["ImageForCustomTemplate"] = "https://www.stimulsoft.com/templates/stimulsoft-v4/images/logo.png"; //For example
              
//Clear standart templates
newReportPanel.removeChild(newReportPanel.childNodes[1]);

//Add custom inner table
var newInnerTable = designer.jsObject.CreateHTMLTable();
newInnerTable.style.margin = "20px";
newReportPanel.appendChild(newInnerTable);

for (var i = 0; i < 15; i++) {
    //Create button
    var customBigButton = designer.jsObject.NewReportPanelButton("customTemplateButton" + i, "My Template " + i, "ImageForCustomTemplate"); //name, text, image

     if (i == 5 || i == 10) {
        //Add to next row
        newInnerTable.addCellInNextRow(customBigButton);
    }
    else {
        //Add to current row
        newInnerTable.addCellInLastRow(customBigButton);
    }

    //Add onclick event
    customBigButton.action = function () {
          var fileMenu = this.jsObject.options.menus.fileMenu || this.jsObject.InitializeFileMenu();
          fileMenu.changeVisibleState(false);
         
          setTimeout(function () {
               //Write your code here
               alert(this.name + " was clicked!");
          }, 200);
     }
}
Thank you.
Post Reply