Javascript Error only when loading Map View

Hi,

All the different views are working except the Map view will not show due to a JavaScript error. I get the JavaScript error below. As you can see in the second screenshot this has an object but _colS is undefined…



Any ideas what could be happening, does this happen when no events exist in the current timespan for example?

Regards,
Lee

Hello,
can you attach a small demo, where we could reproduce the issue?
For now, it’s hard to say what causing the error, since there is no known problems with the map view. Must be something in configuration or custom code.

I started to put everything in a separate test project to test the Map issue isolated from all our other components. But now it doesn’t return the test JSON data, instead it returns the string “System.Web.Mvc.ContentResult”. Please see the screenshot and project file for more info…

The project file can be downloaded from…
[url]http://cloud.seetec.co.uk/seetecwebapi/DHTMLXe.zip[/url]


Hello,
thank you for the sample.
Looks like SchedulerAjaxData behaves differently, when compiled in visual studio 2012, we will fix this issue asap.
As a temporary solution, try implicitly converting SchedulerAjaxData to string, and outputting it with Content method, i.e. Dim res As String = (New SchedulerAjaxData(DummyEventsData)) Return Content(res) I think you’ll have to do the same with AjaxSaveResponse

That works, however I am not using visual studio 2012, I am using 2010 for this test project and on my main project. It works without implicitly converting it to a string in the main project which is strange. Anyway I will do it this way from now on to be sure.

So back to the original issue with the map view, it works perfectly in my test project, but not in my main project. This makes it almost impossible to send the project through to you because its quite a large project which wont run without a lot of dependencies and a large database. So I can only run it within our network.

Perhaps it is a confliction of some sort with one of the other common libraries we use? Here are the other javascript libraries active at the same time as the scheduler…
chosen.jquery.min.js
knockout-2.1.0.js
knockout.mapping.js
jquery-1.7.1.min.js
telerik.common.min.js
telerik.draganddrop.min.js
telerik.splitter.min.js
telerik.window.min.js
kendo.aspnetmvc.min.js
kendo.validator.min.js
kendo.web.min.js

I have zipped them up and attached them. Otherwise if you can test remotely on my machine with my main project I would really appreciate it.

Thanks for your help,
Lee
JS Scripts.zip (207 KB)

This thread mentions a known bug with _colsS at the end, but Its probably not a good idea for me to change the js file to one thats 2 years old.

http://forum.dhtmlx.com/viewtopic.php?f=6&t=12574

When it debug using IE debugger, I get another error…
SCRIPT5009: ‘google’ is undefined

But it doesn’t point me to a specific location perhaps because the scheduler is loaded inside a partial view

Do you have internet collection on the PC where problem occurs ?

Map view for scheduler, will try to load google map library (maps.google.com/maps/api) and if it fails then it will throw
SCRIPT5009: ‘google’ is undefined

You can use dev-tools of IE to check which http requests it sends and do all of them are loaded correctly.

I have now managed to replicate this is the test project.

The issue that the map view doesn’t work when the scheduler is loaded at run time from the browser. I suspect some more handling around the google API is needed when it is loaded like this. Please download the project here to see…

http://cloud.seetec.co.uk/seetecwebapi/DHTMLXe2.zip

Regards,
Lee

Hi,
we reproduced the issue with map view, thank you for providing all details.
I’ll let you know when fix will be ready

Looks like issue happens because google maps scripts are loaded asynchronously, and scheduler’s initalization starts before they are loaded completely.
If you put google api script to your index page, it will solve the issue.

The more clean solution is to use a script loader( like requireJS) which will load scripts exactly when they needed.
i.e to use construction like this
require([‘http://maps.google.com/maps/api/js?sensor=false’, …],
function(){
<%= DHXScheduler.GenerateJSCode() %>
});
But current version of scheduler doesn’t allow you to render initialization code separatly from html markup, this functionality is added to the next version. For now you’ll have to place maps script on your index page