我正在使用TimeGlider进行一段时间的事件显示..非常有趣但我的问题是我必须动态添加所有事件而不是通过JSON文件..就像所有示例所示..问题是addEvent方法当添加一个带有“enddate”的事件时,它不会显示它应该显示的背景范围..但是如果你将相同的事件放在一个json文件中......范围是可见的..更多通过addEvent添加的事件不显示鼠标上的结束日期表明它不考虑“enddate”。
{
"id":"_now1",
"title": "nowEventere",
"date_display":"ho",
"description": "prttt",
"startdate": "2012-01-01 08:00:00",
"enddate": "2012-04-01 08:00:00",
"high_threshold":60,
"importance":"40",
"icon":"triangle_red.png",
"span_color":"#FF0000"
}
所以上面的事件如果在JSON文件中会显示时间跨度但是
var event={
"id":"_now1",
"title": "nowEventere",
"date_display":"ho",
"description": "prttt",
"startdate": "2012-01-01 08:00:00",
"enddate": "2012-04-01 08:00:00",
"high_threshold":60,
"importance":"40",
"icon":"triangle_red.png",
"span_color":"#FF0000",
"timelines":["js_history"]
};
tg_actor.addEvent(event);
只会使用“startdate”..这可能是一个错误,还是活动中缺少某些东西?
答案 0 :(得分:0)
我修复了错误..如果您使用的是下载文件夹..查找JS文件TG_Timeline.js
在文件内查找方法
tg.TG_Event = Backbone.Model.extend({ .......
在initialize方法结束时查找方法调用..
this.set(ev);
在此方法调用
上方添加以下行/*BUG FIX..Imran (20/09/2012) ..time span events added through addEvent method did not show time span .. span attribute was not being added*/
if(ev.cache.span) // if span was set to true .. add attribute
ev["span"]=ev.cache.span;
应该看起来像
/*BUG FIX..Imran (20/09/2012) ..time span events added through addEvent method did not show time span .. span attribute was not being added*/
if(ev.cache.span) // if span was set to true .. add attribute
ev["span"]=ev.cache.span;
this.set(ev);
修复只是将span属性添加到对象中......由于某种原因没有添加..