← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16041: dhis2.selected: change icon of search button when loading data from server

 

------------------------------------------------------------
revno: 16041
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-09 14:02:49 +0700
message:
  dhis2.selected: change icon of search button when loading data from server
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-07-09 06:48:45 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js	2014-07-09 07:02:49 +0000
@@ -60,9 +60,6 @@
       context.source.data('selected', context);
       context.target.data('selected', context);
 
-      context.page = 1;
-      context.defaultProgressiveLoader(context);
-
       context.source.on('dblclick', 'option', context.defaultSourceDblClickHandler);
       context.target.on('dblclick', 'option', context.defaultTargetDblClickHandler);
       context.source.on('scroll', context.makeScrollHandler(context));
@@ -74,9 +71,10 @@
         context.searchButton.on('click', function() {
           context.search.trigger({type: 'keyup', which: 13, keyCode: 13});
         });
-
-        context.searchButton.attr('disabled', true);
       }
+
+      context.page = 1;
+      context.defaultProgressiveLoader(context);
     }
   };
 
@@ -164,6 +162,9 @@
         request.data.filter = 'name:like:' + context.like;
       }
 
+      context.searchButton.find('i').removeClass('fa-search');
+      context.searchButton.find('i').addClass('fa-spinner fa-spin');
+
       return $.ajax(request).done(function( data ) {
         if( data.pager ) {
           if( data.pager.page == 1 ) {
@@ -192,6 +193,9 @@
         });
       }).fail(function() {
         context.source.children().remove();
+      }).always(function() {
+         context.searchButton.find('i').removeClass('fa-spinner fa-spin');
+         context.searchButton.find('i').addClass('fa-search');
       });
     }
   };