Bru*_*o V 5 xml asp.net timeline simile
我创建了一个SIMILE时间轴,它使用XML文件作为数据源,这是在调用aspx命令时由方法创建的.问题是当更新XML文件时,时间轴不会更新并显示第一次加载的数据.仅当我关闭浏览器并使用时间轴再次打开Web应用程序时,才会刷新数据.即使我转到我的Web应用程序的另一个页面,然后回到带有时间轴的页面,数据显示仍然相同.我已经确认在创建时间轴的脚本被调用之前创建/更新了XML文件,我还尝试了一些技巧,例如强制使用PageLoad(),执行Response.Redirect()并且不使用缓存.我的函数onLoad()类似于simile-widget提供的原始函数.码:
<head>
...
<meta http-equiv="pragma" content="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="-1">
...
var tl;
function onLoad() {
$(document).ready(function() {
var eventSource1 = new Timeline.DefaultEventSource(0);
var theme1 = Timeline.ClassicTheme.create();
theme1.timeline_start = new Date(Date.UTC(2010, 0, 1));
theme1.timeline_stop = new Date(Date.UTC(2014, 0, 1));
var d = theme1.timeline_start;
var bandInfos = [
Timeline.createBandInfo({ ... }),
Timeline.createBandInfo({ ... })
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
// create the Timeline
tl = Timeline.create(document.getElementById("tl"), bandInfos);
var url = '.';
// references in the data
tl.loadXML("batch_data.xml", function(xml, url)
{eventSource1.loadXML(xml, url); });
tl.finishedEventLoading();
});
}
...
</head>
<body onload="onLoad();" onresize="onResize();">
<form id="form1" runat="server">
<div id="tl" runat="server">
...
</div>
</form>
</body>
Run Code Online (Sandbox Code Playgroud)
谢谢!
小智 0
第一个线索是您将 javascript 代码包装在 onLoad 函数中。尝试使用 onClick 事件函数创建一个按钮来更新页面。如果你想升级到一段时间你可以使用JavaScript定时事件。
我把这个例子尽可能简单:
setInterval(function(){alert("Hello")},3000);
Run Code Online (Sandbox Code Playgroud)
这就是罪孽
window.setInterval("javascript function",milliseconds);
Run Code Online (Sandbox Code Playgroud)