Hello all, i have too many log to show on timeline, so i decided to load only logs around the center date. This work.
Now i want to load event as the user scroll on the line. I put a on scroll event in the onload function var b1=tl.getBand(1); b1.addOnScrollListener(updateData()); And defined my function as : function updateData() { var eventSource = tl.getBand(1).getEventSource(); eventSource.clear(); var da = tl.getBand(1).getCenterVisibleDate(); var date = new Date(da); var day = date.getDate(); var month = date.getMonth(); var year = date.getFullYear(); Timeline.loadJSON("test.php?d="+day+"&m="+month +"&y="+year, function(json, url) { eventSource.loadJSON(json, url); tl.finishedEventLoading(); }); tl.layout(); } The problem i have is that he call infinitely the test.php page and the script block. What i missed? All the js code (i just work on a "test page"): var tl; var eventSource = new Timeline.DefaultEventSource(0); function onLoad() { var theme1 = Timeline.ClassicTheme.create(); theme1.autoWidth = true; theme1.mouseWheel = "default"; theme1.firstDayOfWeek=1; var bandInfos = [ Timeline.createBandInfo({ overview: true, width: "10%", intervalUnit: Timeline.DateTime.MONTH, eventSource: eventSource, theme: theme1, intervalPixels: 100, timezone: 1 }),Timeline.createBandInfo({ width: "90%", intervalUnit: Timeline.DateTime.DAY, eventSource: eventSource, theme: theme1, intervalPixels: 300, timezone: 1 }) ]; bandInfos[0].syncWith = 1; bandInfos[0].highlight = true; tl = Timeline.create(document.getElementById("tl"), bandInfos); tl.getBand(1).setCenterVisibleDate(Timeline.DateTime.parseGregorianDateTime(new Date())); var da = tl.getBand(1).getCenterVisibleDate(); var date = new Date(da); var day = date.getDate(); var month = date.getMonth(); var year = date.getFullYear(); tl.loadJSON("test.php?d="+day+"&m="+month+"&y="+year, function(json, url) { eventSource.loadJSON(json, url); tl.finishedEventLoading(); tl.getBand(1).setCenterVisibleDate(Timeline.DateTime.parseGregorianDateTime(new Date())); }); var b1=tl.getBand(1); b1.addOnScrollListener(updateData()); } function updateData() { var eventSource = tl.getBand(1).getEventSource(); eventSource.clear(); var da = tl.getBand(1).getCenterVisibleDate(); //alert(da); var date = new Date(da); var day = date.getDate(); var month = date.getMonth(); var year = date.getFullYear(); Timeline.loadJSON("test.php?d="+day+"&m="+month +"&y="+year, function(json, url) { eventSource.loadJSON(json, url); //tl.finishedEventLoading(); }); tl.layout(); } var resizeTimerID = null; function onResize() { if (resizeTimerID == null) { resizeTimerID = window.setTimeout(function() { resizeTimerID = null; tl.layout(); }, 500); } } Thanks -- You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To post to this group, send email to simile-widgets@googlegroups.com. To unsubscribe from this group, send email to simile-widgets+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en.