Skip to content
Browse files

fix vpc menulist bug

  • Loading branch information...
1 parent e65c5fb commit bc7dea691cb0575097c41ecb211d0f0933e21e3a @winebarrel winebarrel committed
Showing with 13 additions and 0 deletions.
  1. +13 −0 ec2ui/content/ec2ui/securitygroupsview.js
View
13 ec2ui/content/ec2ui/securitygroupsview.js
@@ -127,7 +127,10 @@ var ec2ui_SecurityGroupsTreeView = {
var vpcMenu = document.getElementById("ec2ui.securitygroups.vpcmenu");
if (!vpcs || !vpcMenu) { return; }
+ var selectedItem = vpcMenu.selectedItem;
+ var selectedValue = selectedItem ? selectedItem.value : null;
var count = vpcMenu.itemCount;
+ var idx = 0;
for(var i = count - 1; i >= 2; i--) {
vpcMenu.removeItemAt(i);
@@ -136,6 +139,16 @@ var ec2ui_SecurityGroupsTreeView = {
for (var i in vpcs) {
vpcMenu.appendItem(vpcs[i].id + (vpcs[i].tag == null ? '' : " [" + vpcs[i].tag + "]"), vpcs[i].id);
}
+
+ for (var i = 0; i < vpcMenu.itemCount; i++) {
+ var item = vpcMenu.getItemAtIndex(i);
+
+ if (item.value == selectedValue) {
+ idx = i;
+ }
+ }
+
+ vpcMenu.selectedIndex = idx;
},
getSelectedGroup : function() {

0 comments on commit bc7dea6

Please sign in to comment.
Something went wrong with that request. Please try again.