2012-09-19 29 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屬性的對象..由於某種原因沒有被添加..