Updated Branches: refs/heads/4.0 2862774c6 -> 0699d65ef
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/4cb25590 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/4cb25590 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/4cb25590 Branch: refs/heads/4.0 Commit: 4cb2559028e07d3351dc0e55a90526a5972f299c Parents: 2862774 Author: Jessica Wang <[email protected]> Authored: Thu Sep 20 15:16:40 2012 -0700 Committer: Edison Su <[email protected]> Committed: Thu Sep 20 17:13:06 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/4cb25590/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;
