2012-09-19 30 views
0

我使用TimeGlider进行一些时间事件显示..很棒,很有趣,但我的问题是,我必须动态地添加所有事件,而不是通过JSON文件..喜欢所有示例显示..问题是addEvent方法时添加一个事件与“enddate”不显示它应该显示的背景跨度..但是,如果你把相同的事件内部的JSON文件..跨度是可见的..更多的事件添加通过addEvent不会显示鼠标上的enddate,它表明它没有考虑“enddate”。TimeGlider addEvent not reading 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); 

将只使用“开始日期” ...这会是一个bug,或有东西在事件失踪?

回答

0

我有固定的错误..如果您使用的是下载的文件夹..找JS文件TG_Timeline.js

文件查找的方法

tg.TG_Event = Backbone.Model.extend({ ....... 

在初始化结束内部方法找方法调用..

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属性的对象..由于某种原因没有被添加..