DHTMLX 调度程序不会加载数据
DHTMLX Scheduler won't load data
DHTMLX Scheduler 无法加载数据,即使它内联在 html
文档中。
这是我的代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler.js"></script>
<link href="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler_material.css"
rel="stylesheet" type="text/css" charset="utf-8">
<style>
html, body{
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
}
</style>
</head>
<body>
<div id="scheduler_here" class="dhx_cal_container"
style='width:100%; height:100%;'>
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button"> </div>
<div class="dhx_cal_next_button"> </div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
<div class="dhx_cal_tab" name="day_tab"></div>
<div class="dhx_cal_tab" name="week_tab"></div>
<div class="dhx_cal_tab" name="month_tab"></div>
</div>
<div class="dhx_cal_header"></div>
<div class="dhx_cal_data"></div>
</div>
<script>
scheduler.init('scheduler_here', new Date(2019,0,20), "week");
if (scheduler.parse([
{text:"Meeting", start_date:"15/01/2020 14:00", end_date:"15/01/2020 17:00"},
{text:"Conference", start_date:"16/01/2020 12:00", end_date:"16/01/2020 19:00"},
{text:"Interview", start_date:"17/01/2020 09:00", end_date:"17/01/2020 10:00"}
],"json")) {
alert("OK");
}
else {
alert("NOK")
}
</script>
</body>
请在此处查看 fiddle:
https://jsfiddle.net/q9bhgj0s/
我想念什么???
谢谢!
您传递给调度程序的解析方法的事件未呈现,因为未识别为 start_date 和 end_date 属性指定的日期格式。
以下使用可接受的格式演示解析函数:
scheduler.parse([
{text:"Meeting", start_date:"2019-01-15 14:00", end_date:"2019-01-15 17:00"},
{text:"Conference", start_date:"2019-01-16 12:00", end_date:"2019-01-16 19:00"},
{text:"Interview", start_date:"2019-01-17 09:00", end_date:"2019-01-17 10:00"}
], "json");
已更新 Fiddle:https://jsfiddle.net/ChrisCookDev/frwynpds/
此外,请记住调度程序的 parse 方法不会 return 布尔结果(正如您的代码在 "OK" 和 [=23= 的报告中建议的那样) ]):
void parse(object data, [string type] );
作为替代解决方案,您可以根据数据中的日期格式更改 xml_date 配置的值:
scheduler.config.xml_date="%d/%m/%Y %H:%i";
默认情况下,调度程序采用下一种格式的 "start_date"
和 "end_date"
的日期:"mm/dd/yyy H:i"
,因此请将该段落中的日期更改为:"start_date:"01/15/2020 14:00",
end_date:"01/15/2020 17:00"",
或为您的调度程序设置格式日期:scheduler.config.xml_date="%Y-%m-%d %H:%i";
并以此格式传递日期。
DHTMLX Scheduler 无法加载数据,即使它内联在 html
文档中。
这是我的代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler.js"></script>
<link href="https://cdn.dhtmlx.com/scheduler/edge/dhtmlxscheduler_material.css"
rel="stylesheet" type="text/css" charset="utf-8">
<style>
html, body{
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
}
</style>
</head>
<body>
<div id="scheduler_here" class="dhx_cal_container"
style='width:100%; height:100%;'>
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button"> </div>
<div class="dhx_cal_next_button"> </div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
<div class="dhx_cal_tab" name="day_tab"></div>
<div class="dhx_cal_tab" name="week_tab"></div>
<div class="dhx_cal_tab" name="month_tab"></div>
</div>
<div class="dhx_cal_header"></div>
<div class="dhx_cal_data"></div>
</div>
<script>
scheduler.init('scheduler_here', new Date(2019,0,20), "week");
if (scheduler.parse([
{text:"Meeting", start_date:"15/01/2020 14:00", end_date:"15/01/2020 17:00"},
{text:"Conference", start_date:"16/01/2020 12:00", end_date:"16/01/2020 19:00"},
{text:"Interview", start_date:"17/01/2020 09:00", end_date:"17/01/2020 10:00"}
],"json")) {
alert("OK");
}
else {
alert("NOK")
}
</script>
</body>
请在此处查看 fiddle:
https://jsfiddle.net/q9bhgj0s/
我想念什么???
谢谢!
您传递给调度程序的解析方法的事件未呈现,因为未识别为 start_date 和 end_date 属性指定的日期格式。
以下使用可接受的格式演示解析函数:
scheduler.parse([
{text:"Meeting", start_date:"2019-01-15 14:00", end_date:"2019-01-15 17:00"},
{text:"Conference", start_date:"2019-01-16 12:00", end_date:"2019-01-16 19:00"},
{text:"Interview", start_date:"2019-01-17 09:00", end_date:"2019-01-17 10:00"}
], "json");
已更新 Fiddle:https://jsfiddle.net/ChrisCookDev/frwynpds/
此外,请记住调度程序的 parse 方法不会 return 布尔结果(正如您的代码在 "OK" 和 [=23= 的报告中建议的那样) ]):
void parse(object data, [string type] );
作为替代解决方案,您可以根据数据中的日期格式更改 xml_date 配置的值:
scheduler.config.xml_date="%d/%m/%Y %H:%i";
默认情况下,调度程序采用下一种格式的 "start_date"
和 "end_date"
的日期:"mm/dd/yyy H:i"
,因此请将该段落中的日期更改为:"start_date:"01/15/2020 14:00",
end_date:"01/15/2020 17:00"",
或为您的调度程序设置格式日期:scheduler.config.xml_date="%Y-%m-%d %H:%i";
并以此格式传递日期。