1

I am using DHTMLXSCHEDULER (it is a plugin which gives support to touchscreens and ready .js code) in my project.

When I run my project on android emulator I get following error and complete white screen is displayed on emulator

02-11 02:16:21.398: E/Web Console(868): Uncaught ReferenceError: google is not defined at file:///android_asset/codebase/dhxscheduler_mobile.js:316 02-11 02:16:21.405: E/cutils-trace(868): Error opening trace file: No such file or directory (2)

The html code is as follows

<!DOCTYPE html>
<html>
<head>
    <meta  name = "viewport" content = "initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no">
    <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script src="../../codebase/dhxscheduler_mobile.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../codebase/dhxscheduler_mobile.css">

    <title>Custom view: googlemap</title>
    <script type="text/javascript" charset="utf-8">

        /*adding the new view: layout with toolbar and google map*/
        scheduler.config.views.push({
            id:"locationView",
            rows:[
                {
                    view:"toolbar",
                    css:"dhx_topbar",
                    elements:[
                        {
                            view:'button', 
                            inputWidth: 100,
                            css:"cancel",
                            label: scheduler.locale.labels.icon_back,
                            click: "$$('scheduler').$$('views').back()"
                        }
                    ]
                },
                {   view:"googlemap",
                    id:"mymap"
                }
            ]
        });

        /*Enable read-only mode*/
    //  scheduler.config.readonly = true;

        /*the "Location" button in toolbar config*/
        scheduler.config.selected_toolbar = [
            {view:'button', inputWidth:scheduler.xy.icon_back, css:"cancel", id:"back",align:"left",label:scheduler.locale.labels.icon_back},
            {view:'button',  width:100, id:"location",align:"right",label:"Location", click:"showLocation"}, //the new button
            {view:'button',  width:70, id:"edit",align:"right",label:scheduler.locale.labels.icon_edit}
        ];

        /*initial date*/
        scheduler.config.init_date = new Date(2011,5,21);

        function showLocation(){
            /*shows the view of multiview*/
            $$("scheduler").$$("locationView").show();
            /*necessary to resize google map*/
            $$("scheduler").$$("locationView").resize();

            /*map object by view id*/
            var map = $$("scheduler").$$("mymap").map;
            map.setZoom(15);
            /*event data*/
            var eventId = $$("scheduler").getCursor();
            var item = $$("scheduler").item(eventId);
            var y = parseFloat(item.y);
            var x = parseFloat(item.x);
            var details = item.details;
            /*LatLng point*/
            var point = new google.maps.LatLng(x,y);

            map.setCenter(point);
            var marker = new google.maps.Marker({
                 position: point,
                 title: details
            });
            marker.setMap(map); 
        }

        dhx.ready(function(){
            /*initialization*/
            dhx.ui.fullScreen();
            dhx.ui({
                view: "scheduler",
                id: "scheduler"
            });
            /*adding data*/
            var data = [
                {
                    id:1,
                    start_date:"2011-06-21 00:00:00",
                    end_date:"2011-07-05 00:00:00",
                    text:"Wimbledon",
                    details:"Wimbledon June 21, 2011 - July 5, 2011",
                    x:51.439,
                    y:-0.208
                }
            ];
            $$("scheduler").parse(data);
            /*preselects Month view*/
            $$("scheduler").$$("buttons").setValue("month");
        });
    </script>
</head>
<body>
</body>
</html>

The problem is the Google Map script is not getting imported in above code. I am not getting what to do so that the Google Map script gets loaded in the above document.

What could be wrong?

Bleeding Fingers
  • 6,210
  • 7
  • 41
  • 68
Rakesh Patil
  • 67
  • 1
  • 11

0 Answers0