Permalink
Browse files

fix vpc menulist bug

  • Loading branch information...
1 parent c04d56f commit e65c5fb6ffb1ab7f239ddefabc8fb0daf80c0e3b @winebarrel winebarrel committed May 17, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 ec2ui/content/ec2ui/instancesview.js
@@ -829,7 +829,10 @@ var ec2ui_InstancesTreeView = {
var vpcMenu = document.getElementById("ec2ui.instances.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);
@@ -838,6 +841,16 @@ var ec2ui_InstancesTreeView = {
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;
},
enableOrDisableItems : function(event) {

0 comments on commit e65c5fb

Please sign in to comment.