带有DHtmlXScheduler的jQuery Mobile ..数据未加载

时间:2013-04-03 04:53:51

标签: jquery jquery-mobile

我正在尝试使用移动版的DHtmlXScheduler。它运行正常,但我不能让它加载数据。我已经尝试过XML和Json。以下是文档的链接:http://docs.dhtmlx.com/doku.php?id=dhtmlxscheduler:mobile_data

这是我的代码:

<div data-role="page" data-theme="d" id="Top">
    <script src="~/Scripts/dhxscheduler_mobile.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="~/Styles/dhxscheduler_mobile.css">

    <div data-role="content">
        <script type="text/javascript">
            scheduler.config.readonly = true;
            dhx.ready(function () {
                dhx.ui.fullScreen();
                dhx.ui({
                    view: "scheduler",
                    id: "scheduler"
                });
            });
            $("scheduler").parse([
                    { id: 1, start_date: "2013-04-01 0:00", end_date: "2013-04-01 0:00", text: "Event 1" },
                    { id: 2, start_date: "2013-04-05 0:00", end_date: "2013-04-05 0:00", text: "Event 2" }
            ], "json");
        </script>
    </div>
</div>

我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

我浏览了文档,解析事件时应该有两个$$。所以chagne如下

$$("scheduler").parse([
                    { id: 1, start_date: "2013-04-05 0:00", end_date: "2013-04-05 12:00", text: "Event 1" },
                    { id: 2, start_date: "2013-04-05 0:00", end_date: "2013-04-05 1:00", text: "Event 2" }
            ], "json");

将所有内容整合在一起

<div data-role="page" data-theme="d" id="Top">
    <link rel="stylesheet" type="text/css" href="codebase/dhxscheduler_mobile.css">
    <script src="codebase/dhxscheduler_mobile.js" type="text/javascript"></script>

    <div data-role="content">
        <script type="text/javascript">
        scheduler.config.readonly = true;
                dhx.ready(function(){
                    //the method allows you to hide the address bar on iPhone/iPod to save the space for application
                    dhx.ui.fullScreen();
                    //object constructor
                    dhx.ui({
                        view: "scheduler",
                    id: "scheduler"
                    });
                    // method load() lets you to populate the scheduler with data
                    $$("scheduler").parse([
                    { id: 1, start_date: "2013-04-05 0:00", end_date: "2013-04-05 12:00", text: "Event 1" },
                    { id: 2, start_date: "2013-04-05 0:00", end_date: "2013-04-05 1:00", text: "Event 2" }
            ], "json");

                });

        </script>
    </div>
</div>

屏幕截图

enter image description here