Page 1 of 1

Data not showing in the report viewer

Posted: Sat May 20, 2017 7:12 am
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

Re: Data not showing in the report viewer

Posted: Sun May 21, 2017 7:35 pm
by Kubekin Yuriy
Hello, giardia.

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

Thank you.