微笑时间线小工具添加自定义字段

时间:2012-09-11 11:56:25

标签: javascript

我想在事件数据源中添加几个自定义字段,例如:

{"events":
   [
      {"isDuration": "true",
       "description": "my description
       "color": "#ffcc00",
       "image": "/images/my-img.jpg",
       "link": "http://www.google.co.uk",
       "icon": "/images/red-ico.png",
       "end": null,
       "title": "my title",
       "start": "2012,09,30",
       "textColor": "#777",
       "customField_1": "abc"
       "customField_2" : "def"}
   ]
}

然后在showBubble事件中检索 customField_1 customField_2 ,如下所示:

Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {

      var cust1 = evt.getCustom1();
      var cust2 = evt.getCustom2();
}

是否可以添加这些get方法,我将如何进行呢?

1 个答案:

答案 0 :(得分:0)