Updated Branches:
  refs/heads/master 14dd9cd19 -> edc6b4c6d

cloudstack UI - listView widget - basic search - fix a bug that happened on IE 
browser that clicking Enter key didn't do the searching.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/edc6b4c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/edc6b4c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/edc6b4c6

Branch: refs/heads/master
Commit: edc6b4c6da85ecfaadb94d32b099c57fe0c62350
Parents: 14dd9cd
Author: Jessica Wang <[email protected]>
Authored: Thu Sep 20 15:16:40 2012 -0700
Committer: Jessica Wang <[email protected]>
Committed: Thu Sep 20 15:25:50 2012 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/listView.js |   35 +++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/edc6b4c6/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js 
b/ui/scripts/ui/widgets/listView.js
index fb1d884..7183e93 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -669,7 +669,8 @@
     var $search = $('<div></div>').addClass('text-search reduced-hide');
     var $searchBar = $('<div></div>').addClass('search-bar reduced 
hide').appendTo($search);
     $searchBar.append('<input type="text" />');
-    $search.append('<div class="button search"></div>');
+    $search.append('<div id="basic_search" class="button search"></div>');
+               //$search.append('<div id="advanced_search" class="button 
search"></div>');
 
     return $search.appendTo($toolbar);
   };
@@ -1316,7 +1317,7 @@
       return true;
     });
 
-    var search = function() {
+    var basicSearch = function() {
       page = 1;
       loadBody(
         $table,
@@ -1341,13 +1342,18 @@
         }
       );
     };
-
-    $listView.find('.search-bar input[type=text]').change(function(event) {
-      search();
-    });
-
-    // Setup filter events
-    $listView.find('.button.search, select').bind('change', function(event) {
+               
+               //basic search
+    $listView.find('.search-bar input[type=text]').keyup(function(event) {     
+                       if(event.keyCode == 13) //13 is keycode of Enter key    
        
+        basicSearch();
+                       return true;
+    });                    
+    $listView.find('.button.search#basic_search').bind('click', 
function(event) {                                      
+      basicSearch();                   
+      return true;
+    });                        
+               $listView.find('select').bind('change', function(event) {
       if ($(event.target).closest('.section-select').size()) return true;
       if ((event.type == 'click' ||
            event.type == 'mouseup') &&
@@ -1356,11 +1362,18 @@
            $(event.target).is('input')))
         return true;
 
-      search();
+      basicSearch();
 
       return true;
     });
-
+               
+               //advanced search 
+               /*
+    $listView.find('.button.search#advanced_search').bind('click', 
function(event) {   
+      return true;
+    });                
+               */
+               
     // Infinite scrolling event
     $listView.bind('scroll', function(event) {
       if (args.listView && args.listView.disableInfiniteScrolling) return 
false;

Reply via email to