leo*_*ora 5 javascript ajax asp.net-mvc simile
我使用javascript simile时间轴有一个非常大的描述字段的时间轴项目.我不希望膨胀我的初始json有效载荷数据与所有这些,因为当有人点击时间轴项目时它是唯一需要的.
例如,在这个JSON结果上:
{
'dateTimeFormat': 'iso8601',
'wikiURL': "http://simile.mit.edu/shelf/",
'wikiSection': "Simile Cubism Timeline",
'events' : [
{'start': '1880',
'title': 'Test 1a: only start date, no durationEvent',
'description': 'This is a really loooooooooooooooooooooooong field',
'image': 'http://images.allposters.com/images/AWI/NR096_b.jpg',
'link': 'http://www.allposters.com/-sp/Barfusserkirche-1924-Posters_i1116895_.htm'
},
Run Code Online (Sandbox Code Playgroud)
我想要从JSON中一起删除描述字段(或发送null),并通过另一个ajax调用将其加载到onmand.
无论如何在初始加载期间没有发送desription字段,当有人点击时间轴项目时,它会通过ajax在该点加载描述
我认为这将是一个常见的功能,但我找不到它
我认为您需要做的事情类似于 @dacracot 所建议的,但您可以利用 Timeline 文档中描述的一些处理程序,特别是onClick handler。所以我想象你会做的是这样的:
//save off the default bubble function
var defaultShowBubble = Timeline.OriginalEventPainter.prototype._showBubble;
//overwrite it with your version that retrieves the description first
Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {
//make AJAX call here
//have the callback fill your description field in the JSON and then call
//the defaultShowBubble function
}
Run Code Online (Sandbox Code Playgroud)
至少有一部分我还没有回答,那就是如何确定哪个事件被点击,但你可能可以从evt.getID()
编辑:哦,另一个棘手的部分可能是如何将描述插入到时间线数据中。我只是对时间轴这个东西不够熟悉,不知道它是如何完成的。
| 归档时间: |
|
| 查看次数: |
2250 次 |
| 最近记录: |