← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15399: support resources without paging in progressive selected loader

 

------------------------------------------------------------
revno: 15399
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-05-26 10:47:43 +0200
message:
  support resources without paging in progressive selected 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-05-06 03:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js	2014-05-26 08:47:43 +0000
@@ -61,6 +61,7 @@
       context.target.data('selected', context);
 
       context.page = 1;
+      context.paging = true;
       context.defaultProgressiveLoader(context);
 
       context.source.on('dblclick', 'option', context.defaultSourceDblClickHandler);
@@ -158,13 +159,19 @@
       }
 
       return $.ajax(request).done(function( data ) {
-        if( data.pager.page == 1 ) {
+        if( data.pager ) {
+          if( data.pager.page == 1 ) {
+            context.source.children().remove();
+          }
+
+          context.page++;
+        }
+
+        if( typeof data.pager === 'undefined' ) {
           context.source.children().remove();
         }
 
-        context.page++;
-
-        if( context.page > data.pager.pageCount ) {
+        if( typeof data.pager === 'undefined' || context.page > data.pager.pageCount ) {
           delete context.page;
         }