DateTime Format Issue

Stimulsoft Reports.JS discussion
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: DateTime Format Issue

Post by BCS »

Worked like a charm, thank you very much.

If I wanted to specify a specific page (emulating the textbox with current page #), would be a long the same lines but with "GoToPage" or how would that look
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: DateTime Format Issue

Post by HighAley »

Hello.

It need more code to call the GoToPage.
We need some time to prepare a sample for you.

Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: DateTime Format Issue

Post by BCS »

Sure thing, appreciate the help to my barrage of questions.

Your example will probably include this part but, I'm also trying to make a call to:

Code: Select all

viewer.jsObject.reportParams.pageCount
for the total page count but it always writes a zero, however in the console when logged it shows the correct value

I've also tried

Code: Select all

report.pages.count
as well as

Code: Select all

report.renderedPages.count
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: DateTime Format Issue

Post by HighAley »

Hello

Here is the code of the GoToPage action:

Code: Select all

viewer.jsObject.reportParams.pageNumber = pageNumber; //first page number 0
viewer.jsObject.postAjax(
    viewer.jsObject.options.requestUrl.replace("{action}", viewer.jsObject.options.actions.viewerEvent),
   { action: "GetPages" },
   viewer.jsObject.showReportPage);
Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: DateTime Format Issue

Post by BCS »

This worked fine, thank you again, however making the call to

Code: Select all

viewer.jsObject.reportParams.pagesCount
is always showing zero. If I console log that code and also log

Code: Select all

viewer.jsObject.reportParams
you can see the correct number of pages for reportParams but not for pagesCount.

Code: Select all

console.log(viewer.jsObject.reportParams);
console.log("Page Count: " + viewer.jsObject.reportParams.pagesCount);
Screenshot at Feb 20 12-45-38.png
Screenshot at Feb 20 12-45-38.png (50.06 KiB) Viewed 6633 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: DateTime Format Issue

Post by HighAley »

Hello.

When do you check the pagesCount?
Maybe there is no information about the count of pages at this moment?

Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: DateTime Format Issue

Post by BCS »

Screenshot from previous post is where those console logs are

Code: Select all

     $.ajax({
                type: 'GET',
                url: "url/to/data",
                dataType: 'json',
                contentType: 'application/json',
                data:
                    {
                        'start' : moment(start).format('YYYY-MM-DD'),
                        'end' : moment(end).format('YYYY-MM-DD')
                    },

                success: function(d) {
                    if(d.count != 0) {
                        var dataSet = new Stimulsoft.System.Data.DataSet("DataSet");

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

                        report.loadFile('Report.mrt'));
                        report.dictionary.databases.clear();
                        dataSet.readJson(d);
                        report.regData(dataSet.dataSetName, "", dataSet);
                        report.dictionary.synchronize();
                        viewer.report = report;
                        viewer.renderHtml("viewerContent");
                    }
                    else {
                        viewer = new Stimulsoft.Viewer.StiViewer(options, "viewerContent", false);

                        viewer.report = null;
                        viewer.renderHtml("viewerContent");
                    }
                },

                failure: function(errMsg) {
                    
                }
            }).done(function(data) {
                        //page count would be called here
                        console.log(viewer.jsObject.reportParams);
                        console.log("Page Count: " + viewer.jsObject.reportParams.pagesCount);
            });
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: DateTime Format Issue

Post by HighAley »

Hello.

Please, try to call the render() method.

Code: Select all

report.dictionary.synchronize();
report.render();
viewer.report = report;
Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: DateTime Format Issue

Post by BCS »

If I make those changes, nothing is render at all, I have a div where the report is to rendered.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: DateTime Format Issue

Post by HighAley »

Hello.

Lets try again.
If you need to know the Number of Pages of the rendered report, you could render the report and get the number of rendered pages.
When you get it from the viewer.jsObject.reportParams.pagesCount, it seems that there is no such information yet.

Thank you.
Post Reply