added basic pagination
authorveltr
Thu, 03 Oct 2013 12:58:33 +0200
changeset 99 281ef3fd6f84
parent 98 abead2de6332
child 100 f1f97f1c7557
added basic pagination
timeline/js/timeline.js
--- a/timeline/js/timeline.js	Mon Sep 23 12:42:30 2013 +0200
+++ b/timeline/js/timeline.js	Thu Oct 03 12:58:33 2013 +0200
@@ -480,14 +480,22 @@
 
 Tlns.Classes.Timeline.prototype.loadOccurrences = function() {
     var _this = this;
-    $.getJSON(this.api_endpoint, {
-        method: this.api_method,
-        api_key: this.token,
-        mail: this.email
-    }, function(_data) {
-        console.log(_data);
-        _this.onOccurrencesLoaded(_data);
-    });
+    
+    function getData(cursor) {
+        $.getJSON(_this.api_endpoint, {
+            method: _this.api_method,
+            api_key: _this.token,
+            mail: _this.email,
+            cursor: cursor
+        }, function(_data) {
+            _this.onOccurrencesLoaded(_data);
+            if (_data.cursor.hasNext) {
+                getData(_data.cursor.next);
+            }
+        });
+    }
+    
+    getData();
     
 };