aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/webapp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-13 11:05:32 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-13 11:05:32 +0100
commit9a7942916254da71ea762d7d05f4626273dc3df6 (patch)
treecc242a5471e0c4db6138995644b67ce2a93239d0 /src/main/resources/webapp
parent694e8b03515f25e36cef855eddb835355eff4c51 (diff)
downloadesper-testing-9a7942916254da71ea762d7d05f4626273dc3df6.tar.gz
esper-testing-9a7942916254da71ea762d7d05f4626273dc3df6.tar.bz2
esper-testing-9a7942916254da71ea762d7d05f4626273dc3df6.tar.xz
esper-testing-9a7942916254da71ea762d7d05f4626273dc3df6.zip
PagingTableService:
o Preventing sending too many queries. Sending the latest query when the previous one completes.
Diffstat (limited to 'src/main/resources/webapp')
-rwxr-xr-xsrc/main/resources/webapp/apps/core/PagingTableService.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/main/resources/webapp/apps/core/PagingTableService.js b/src/main/resources/webapp/apps/core/PagingTableService.js
index 86d08f1..a2d53f9 100755
--- a/src/main/resources/webapp/apps/core/PagingTableService.js
+++ b/src/main/resources/webapp/apps/core/PagingTableService.js
@@ -11,7 +11,12 @@ function PagingTableService() {
queryStart: 0
};
- var update = function(){
+ var update = function () {
+ var query = self.query;
+ if (self.currentlySearching) {
+ console.log("query active, storing =", query);
+ return;
+ }
self.currentlySearching = true;
self.queryStart = new Date().getTime();
@@ -20,16 +25,22 @@ function PagingTableService() {
$scope.$apply();
}, 500);
- fetchCallback(self.startIndex, self.count, self.query, function(data) {
+ fetchCallback(self.startIndex, self.count, query, function (data) {
var now = new Date().getTime();
console.log("Query took " + (now - self.queryStart) + "ms");
clearInterval(interval);
self.rows = data.rows;
- watcher();
self.currentlySearching = false;
self.queryStart = 0;
+
+ if(self.query != query) {
+ console.log("Had a new query requested, sending. query =", query, ", self.query =", self.query);
+ update();
+ }
+
+ watcher();
});
};
@@ -115,7 +126,7 @@ function PagingTableService() {
if(count) {
args.count = count;
}
- if(query) {
+ if(query || query == "") {
args.query = query;
}
console.log("Fetching page. args =", args);