Data not showing in the report viewer

Stimulsoft Reports.WEB discussion
Post Reply
giardia
Posts: 1
Joined: Sat May 20, 2017 6:59 am

Data not showing in the report viewer

Post by giardia »

Hi
I have a modal form to load preview of report and use js script to call ajax and get data and then pass it to mrt report. My problem is No data showing in the report view. maybe no binding happens. Then I try Firebug and get the following error in the console:

TypeError: Stimulsoft.Reports is undefined

The following js code is what I use:

Code: Select all

$(document).ready(function () {
 
    $("[id*=ShowReport]").click(function (evt) {

        $('#GroupsRolesReportModal').modal({
            backdrop: 'static',
            keyboard: true,

        }, 'show');

        var BaseUrl = myApp.Urls.baseUrl;
        var urlToGrava = myApp.Urls.gravaCookieUrl;
 
        $.ajax({
            url: urlToGrava,  
            type: "POST",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { 
                
                var JsonHeader = JSON.stringify(data.Header);
               var JsonGroupRoles = JSON.stringify(data.GroupRoles); //JSON.stringify
 
               var report = new Stimulsoft.Report.StiReport();
               report.loadFile("/Content/Reports/GroupRoles1.mrt");

               var HeaderDataset = new Stimulsoft.System.Data.DataSet("Header");
               HeaderDataset.readJson(JsonHeader)

               var GroupRolesDataset = new Stimulsoft.System.Data.DataSet("GroupRoles");
               GroupRolesDataset.readJson(JsonGroupRoles)

                 report.dictionary.databases.clear();
             report.regData(GroupRolesDataset.dataSetName,"", GroupRolesDataset);

           //    report.regData("Data from User Sources", "Data from User Sources", HeaderDataset);
               //report.regData(dataSet.dataSetName, "", dataSet);

              // report.dictionary.connect(false);
               report.dictionary.synchronize();
               report.render();
 
               var options = new Stimulsoft.Viewer.StiViewerOptions();
               options.appearance.rightToLeft = true;
               //options.appearance.fullScreenMode = true;

               var viewer = new Stimulsoft.Viewer.StiViewer(options,"StiViewer",false);
               viewer.report = report;

               viewer.renderHtml("GroupsRolesReportModalBody");
            }
        });
    });
});
and the following is what I referenced for using js files of stimulsoft reporting, in the script section of my view:

Code: Select all

    <script src="@Url.Content("/Scripts/CustomScripts/GroupRolesReport1.js")"></script>
    <link href="@Url.Content("/Content/stimulsoft.viewer.office2013.whiteblue.css")" rel="stylesheet" />
    <script src="@Url.Content("/Scripts/stimulsoft.reports.pack.js")"></script>

     <script ssrc="@Url.Content("/Scripts/stimulsoft.reports.js")" ></script > 
    <script src="@Url.Content("/Scripts/stimulsoft.viewer.pack.js")"></script>
So what is my mistake?
Thank you
Kubekin Yuriy
Posts: 10
Joined: Wed May 17, 2017 9:24 pm

Re: Data not showing in the report viewer

Post by Kubekin Yuriy »

Hello, giardia.

You must load file "stimulsoft.reports.js" first.

Thank you.
Post Reply