From a5c9c560ffca028fd3fe6576091e5196a91a67a0 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 4 Oct 2012 16:29:10 -0700 Subject: [PATCH] cloudstack UI - listView widget - keep advanced search criteria when scrolling down grid when the last search is from advanced search dialog. --- ui/scripts/ui/widgets/listView.js | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index d341d553ab7..a6d21136864 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -1325,7 +1325,9 @@ }); //basic search - var basicSearch = function() { + var basicSearch = function() { + $listView.removeData('advSearch'); + page = 1; loadBody( $table, @@ -1375,7 +1377,9 @@ }); //advanced search - var advancedSearch = function(args) { + var advancedSearch = function(args) { + $listView.data('advSearch', args.data); + page = 1; loadBody( $table, @@ -1425,17 +1429,24 @@ if (loadMoreData) { page = page + 1; - + + var filterBy = { + kind: $listView.find('select[id=filterBy]').length > 0? $listView.find('select[id=filterBy]').val(): 'all' + }; + if($listView.data('advSearch') == null) { + filterBy.search = { + value: $listView.find('input[type=text]').length > 0? $listView.find('input[type=text]').val(): '', + by: 'name' + }; + } + else { + filterBy.advSearch = $listView.data('advSearch'); + } + loadBody($table, listViewData.dataProvider, listViewData.preFilter, listViewData.fields, true, { context: context, page: page, - filterBy: { - kind: $listView.find('select[id=filterBy]').length > 0? $listView.find('select[id=filterBy]').val(): 'all', - search: { - value: $listView.find('input[type=text]').length > 0? $listView.find('input[type=text]').val(): '', - by: 'name' - } - } + filterBy: filterBy }, actions, { reorder: listViewData.reorder });