当我第一次使用有效数据调用以下内容时......一切正常,表格看起来很棒:
<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轴标题的高度翻倍。然后我再次打电话,它将最后一个双号加倍...
知道我做错了吗?
答案 0 :(得分:1)
如果它对某人有帮助
&#39;调度&#39;是一个全局对象,因此当您多次调用此块时,它会覆盖时间轴视图并每次重新初始化调度程序。这不是理想的方法,在你的情况下,它应该是一个奇怪的副作用的原因。
如果您需要此脚本以重新加载事件,时间轴的各个部分以及更改活动日期,您可以执行以下操作:
静态代码:
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
答案 1 :(得分:0)
scheduler.xy.scale_height = 30;
我添加了这行代码;它会覆盖奇怪的高度问题。耶
答案 2 :(得分:0)
否则,您可以在下面指定dhtmlx移动调度程序的宽度和高度..
dhx.ui({
观点:“窗”,
高度:300,
宽度:300,
...
})
链接:: http://docs.dhtmlx.com/touch/doku.php?id=api:module_baseview 问候, Yuvaraj
答案 3 :(得分:0)
只需在scheduler.createTimelineView中添加属性“section_autoheight:false”即可。这将解决问题。