1

当我第一次使用有效数据调用以下内容时......一切都很好,表格看起来很棒:

        <script language = "javascript">  
            scheduler.clearAll();

            scheduler.createTimelineView({ 
                section_autoheight: false, 
                name: "timeline", 
                x_unit: "day", 
                x_date: "%d", 
                x_step: 1, 
                x_size: 30, 
                x_start: 1, 
                y_unit: <?php echo json_encode($json); ?>, 
                y_property: "section_id", 
                render: "tree", 
                fit_events: true, 
                dy: 30, 
                //dx: 150, 
                second_scale:{
                x_unit: "day", 
                x_date: "%M" 
                } 
            });      

            scheduler.config.lightbox.sections = [  
                {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
                {name:"custom", height:23, type:"timeline", options:null , map_to:"section_id" }, //type should be the same as name of the tab
                {name:"time", height:72, type:"time", map_to:"auto"}
            ];

            scheduler.init('scheduler_here',new Date(<?php echo date("Y"); ?>, <?php echo date("n") - 1; ?>, <?php echo date("j"); ?>),"timeline");

            scheduler.parse(<?php echo json_encode($scheduler); ?>, "json");
        </script>  

但是当我再次调用同一个块时,x 轴标题的高度加倍。然后我再次打电话,它使最后一个双数加倍..

知道我做错了什么吗?

4

4 回答 4

1

如果它仍然对某人有帮助

'scheduler' 是一个全局对象,因此当您多次调用此块时,它会覆盖时间线视图并每次重新初始化调度程序。这不是理想的方法,在您的情况下,它应该是奇怪副作用的原因。

如果您需要此脚本来重新加载事件、时间线部分和更改活动日期,您可以执行以下操作:

  1. 将未修改的配置放入页面的静态部分
  2. 使用“ scheduler.serverList ”方法指定时间线的各个部分
  3. 在重新加载的代码中,您只需使用“ scheduler.updateCollection ”更新时间线部分,解析事件,使用“ scheduler.setCurrentView ”更改活动日期

静态代码:

scheduler.createTimelineView({
    section_autoheight: false,
    name: "timeline",
    x_unit: "day",
    x_date: "%d",
    x_step: 1,
    x_size: 30,
    x_start: 1,
    y_unit: scheduler.serverList("timeline", []),
    y_property: "section_id",
    render: "tree",
    fit_events: true,
    dy: 30,
    //dx: 150,
    second_scale:{
        x_unit: "day",
        x_date: "%M"
    }
});
scheduler.config.lightbox.sections = [
    {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
    {name:"custom", height:23, type:"timeline", options:null , map_to:"section_id" }, //type should be the same as name of the tab
    {name:"time", height:72, type:"time", map_to:"auto"}
];

scheduler.init('scheduler_here',new Date(),"timeline");

重新加载的代码

<script language = "javascript">
    scheduler.clearAll();
    scheduler.updateCollection("timeline", <?php echo json_encode($json); ?>);
    scheduler.parse(<?php echo json_encode($scheduler); ?>, "json");
    scheduler.setCurrentView(new Date(<?php echo date("Y"); ?>, <?php echo date("n") - 1; ?>, <?php echo date("j"); ?>));

</script>

相关文档:

http://docs.dhtmlx.com/scheduler/api__scheduler_serverlist.html http://docs.dhtmlx.com/scheduler/api__scheduler_updatecollection.html http://docs.dhtmlx.com/scheduler/api__scheduler_setcurrentview.html

于 2014-01-21T10:55:40.447 回答
1
scheduler.xy.scale_height = 30;

我添加了这行代码;它覆盖了奇怪的高度问题。耶

于 2012-08-30T14:41:23.023 回答
1

只需在 scheduler.createTimelineView 中添加属性“section_autoheight : false”。这将解决问题。

于 2014-05-13T08:52:50.333 回答
0

否则,您可以指定 dhtmlx 移动调度程序的宽度和高度。如下所示。

dhx.ui ({ view:"window", height:300, width:300, ...
})

链接:: http://docs.dhtmlx.com/touch/doku.php?id=api:module_baseview 问候,Yuvaraj

于 2014-01-10T04:51:22.533 回答