← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14711: fixes to selected progressive loader

 

------------------------------------------------------------
revno: 14711
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-07 09:58:35 +0700
message:
  fixes to selected progressive loader
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js	2014-04-07 02:08:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js	2014-04-07 02:58:35 +0000
@@ -109,6 +109,10 @@
       }
     },
     defaultProgressiveLoader: function( settings, search ) {
+      if( settings.page === undefined ) {
+        return;
+      }
+
       var request = {
         url: settings.url,
         data: {
@@ -124,13 +128,14 @@
       }
 
       return $.ajax(request).done(function( data ) {
-        if( data.pager === undefined || data.pager.page == 1 ) {
-          settings.page = 1;
+        if( data.pager.page == 1 ) {
           settings.source.children().remove();
         }
 
-        if( data.pager.pageCount >= settings.page ) {
-          settings.page = data.pager.pageCount;
+        settings.page++;
+
+        if( settings.page > data.pager.pageCount ) {
+          delete settings.page;
         }
 
         if( data[settings.iterator] === undefined ) {