cloudstack UI - advanced search - introduce new property "advSearchFields" to lsitViewData.

This commit is contained in:
Jessica Wang 2012-09-26 15:14:18 -07:00
parent d1bc54fc84
commit 45360b7a57
2 changed files with 31 additions and 6 deletions

View File

@ -49,6 +49,32 @@
} }
*/ */
}, },
advSearchFields: {
name: { label: 'Name' },
zoneid: {
label: 'Zone',
select: function(args) {
$.ajax({
url: createURL('listZones'),
data: {
listAll: true
},
success: function(json) {
var zones = json.listzonesresponse.zone;
args.response.success({
data: $.map(zones, function(zone) {
return {
id: zone.id,
description: zone.name
};
})
});
}
});
}
}
},
// List view actions // List view actions
actions: { actions: {
@ -274,6 +300,7 @@
if(args.filterBy != null) { if(args.filterBy != null) {
if(args.filterBy.advSearch != null && typeof(args.filterBy.advSearch) == "object") { if(args.filterBy.advSearch != null && typeof(args.filterBy.advSearch) == "object") {
for(var key in args.filterBy.advSearch) { for(var key in args.filterBy.advSearch) {
if(args.filterBy.advSearch[key] != null && args.filterBy.advSearch[key].length > 0)
array1.push("&" + key + "=" + args.filterBy.advSearch[key]); array1.push("&" + key + "=" + args.filterBy.advSearch[key]);
} }
} }

View File

@ -1394,9 +1394,7 @@
cloudStack.dialog.createForm({ cloudStack.dialog.createForm({
form: { form: {
title: 'Advanced Search', title: 'Advanced Search',
fields: { fields: listViewData.advSearchFields
name: { label: 'Name' }
}
}, },
after: function(args) { after: function(args) {
advancedSearch(args); advancedSearch(args);