Page 1 of 1

Cannot read property '0' of null when clicking preview

Posted: Mon Sep 03, 2018 4:26 am
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)

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

Posted: Mon Sep 03, 2018 8:21 am
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.

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

Posted: Mon Sep 03, 2018 10:03 pm
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

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

Posted: Wed Sep 05, 2018 8:25 am
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.

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

Posted: Wed Sep 05, 2018 11:37 pm
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

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

Posted: Thu Sep 06, 2018 7:00 am
by Lech Kulikowski
Hello

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

Thank you.