1

我在我的项目中使用 DHTMLXSCHEDULER(它是一个支持触摸屏和现成 .js 代码的插件)。

当我在 android 模拟器上运行我的项目时,出现以下错误,并且模拟器上显示完整的白屏

02-11 02:16:21.398:E/Web 控制台(868):未捕获的 ReferenceError:google 未在文件中定义:///android_asset/codebase/dhxscheduler_mobile.js:316 02-11 02:16:21.405:E/ cutils-trace(868):打开跟踪文件时出错:没有这样的文件或目录 (2)

html代码如下

<!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>

问题是谷歌地图脚本没有在上面的代码中被导入。我不知道该怎么做才能将 Google Map 脚本加载到上述文档中。

有什么问题?

4

0 回答 0