Skip to content

Commit a5c9c56

Browse files
author
Jessica Wang
committed
cloudstack UI - listView widget - keep advanced search criteria when scrolling down grid when the last search is from advanced search dialog.
1 parent a2a1e19 commit a5c9c56

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

ui/scripts/ui/widgets/listView.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,9 @@
13251325
});
13261326

13271327
//basic search
1328-
var basicSearch = function() {
1328+
var basicSearch = function() {
1329+
$listView.removeData('advSearch');
1330+
13291331
page = 1;
13301332
loadBody(
13311333
$table,
@@ -1375,7 +1377,9 @@
13751377
});
13761378

13771379
//advanced search
1378-
var advancedSearch = function(args) {
1380+
var advancedSearch = function(args) {
1381+
$listView.data('advSearch', args.data);
1382+
13791383
page = 1;
13801384
loadBody(
13811385
$table,
@@ -1425,17 +1429,24 @@
14251429

14261430
if (loadMoreData) {
14271431
page = page + 1;
1428-
1432+
1433+
var filterBy = {
1434+
kind: $listView.find('select[id=filterBy]').length > 0? $listView.find('select[id=filterBy]').val(): 'all'
1435+
};
1436+
if($listView.data('advSearch') == null) {
1437+
filterBy.search = {
1438+
value: $listView.find('input[type=text]').length > 0? $listView.find('input[type=text]').val(): '',
1439+
by: 'name'
1440+
};
1441+
}
1442+
else {
1443+
filterBy.advSearch = $listView.data('advSearch');
1444+
}
1445+
14291446
loadBody($table, listViewData.dataProvider, listViewData.preFilter, listViewData.fields, true, {
14301447
context: context,
14311448
page: page,
1432-
filterBy: {
1433-
kind: $listView.find('select[id=filterBy]').length > 0? $listView.find('select[id=filterBy]').val(): 'all',
1434-
search: {
1435-
value: $listView.find('input[type=text]').length > 0? $listView.find('input[type=text]').val(): '',
1436-
by: 'name'
1437-
}
1438-
}
1449+
filterBy: filterBy
14391450
}, actions, {
14401451
reorder: listViewData.reorder
14411452
});

0 commit comments

Comments
 (0)