Cannot read property '0' of null when clicking preview

Stimulsoft Reports.WEB discussion
Post Reply
Sellorio-SyncSoft
Posts: 6
Joined: Tue Jun 12, 2018 9:59 pm

Cannot read property '0' of null when clicking preview

Post by Sellorio-SyncSoft »

Getting a JavaScript error when clicking on the Preview tab.

Using a data source which I added using code like this (in case that is the cause):

Code: Select all

var queryResult = DatabaseInformationLogic.AdHocReportQuery(AddOnHelper, AddOnHelper.StorageHelper.ReadFile(queryFilename), maxRows: 0);
result.RegData("Data", QueryResultToDataSet(queryResult));
result.Dictionary.Synchronize();

The URL for the Preview Action is not called at the time of the exception so it is not caused by that.

I have determined that the cause is that while merging options, it is iterating over each character in the "scriptUrl" string. This string is null in one of the two sets of options. Also I suspect it's not actually meant to iterate over this string but was intended to iterate over the options recursively.

Code: Select all

Uncaught TypeError: Cannot read property '0' of null
    at StiJsViewer.mergeOptions (stimulsoft.viewer.js:9)
    at StiJsViewer.mergeOptions (stimulsoft.viewer.js:9)
    at new StiJsViewer (stimulsoft.viewer.js:7)
    at createViewer (__designer-event?queryId=0903085017SEAM&stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2018.2.2&stiweb_data=DesignerScripts:27131)
    at StiMobileDesigner.ExecuteAction (__designer-event?queryId=0903085017SEAM&stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2018.2.2&stiweb_data=DesignerScripts:27144)
    at HTMLDivElement.button.action (__designer-event?queryId=0903085017SEAM&stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2018.2.2&stiweb_data=DesignerScripts:37932)
    at HTMLDivElement.button.onclick (__designer-event?queryId=0903085017SEAM&stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2018.2.2&stiweb_data=DesignerScripts:20443)
Attachments
2018-09-03 14_22_02-DevTools - localhost_65468_database_ad-hoc-report_create_queryId=0903085017SEAM.png
2018-09-03 14_22_02-DevTools - localhost_65468_database_ad-hoc-report_create_queryId=0903085017SEAM.png (18.73 KiB) Viewed 1957 times
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Cannot read property '0' of null when clicking preview

Post by Lech Kulikowski »

Hello,

Please check the last release version. If the issue still present, please send us a simple project which reproduces the issue for analysis.

Thank you.
Sellorio-SyncSoft
Posts: 6
Joined: Tue Jun 12, 2018 9:59 pm

Re: Cannot read property '0' of null when clicking preview

Post by Sellorio-SyncSoft »

Hi there,

We are using the latest version already (2018.2.3).

I don't have time to create example solutions. Also, even if the separate solution worked, that would not help us since our product is large and established - we cannot rebuild the product around a successful implementation of your library.

I think you will find the analysis I did in the original post to be more than enough to at least begin investigation (i.e. eye-ball the code).

Thank you,
Sea
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Cannot read property '0' of null when clicking preview

Post by Lech Kulikowski »

Hello,

Most probably, are used different products on one page - JS and APS.
We have added additional checks. Will be available in the next release build within one or two weeks.

Thank you.
Sellorio-SyncSoft
Posts: 6
Joined: Tue Jun 12, 2018 9:59 pm

Re: Cannot read property '0' of null when clicking preview

Post by Sellorio-SyncSoft »

Hi Lech,

That was it! I was including the JavaScript files manually on the page which was causing issues since the MVC method automatically brings in the CSS and JavaScript that it needs. All working correctly now :)

Thanks,
Sea
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Cannot read property '0' of null when clicking preview

Post by Lech Kulikowski »

Hello

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

Thank you.
Post Reply