cloudstack UI - listView widget - keep advanced search criteria when scrolling down grid when the last search is from advanced search dialog.

This commit is contained in:
Jessica Wang 2012-10-04 16:29:10 -07:00
parent a2a1e19e70
commit a5c9c560ff
1 changed files with 21 additions and 10 deletions

View File

@ -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
});