[Commits] r1218 - apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer

commits at geoext.org commits at geoext.org
Sat Jul 4 02:28:07 CEST 2009


Author: tschaub
Date: 2009-07-04 02:28:06 +0200 (Sat, 04 Jul 2009)
New Revision: 1218

Modified:
   apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/Embed.js
Log:
IE doesn't like the insert at an index bigger than the item count.

Modified: apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/Embed.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/Embed.js	2009-07-03 23:59:49 UTC (rev 1217)
+++ apps/opengeo/geoexplorer/trunk/src/script/app/GeoExplorer/Embed.js	2009-07-04 00:28:06 UTC (rev 1218)
@@ -129,7 +129,7 @@
             this.mapPanel.layers.each(function(record) {
                 var layer = record.get("layer");
                 if(layer.displayInLayerSwitcher) {
-                    menu.insert(2, new Ext.menu.CheckItem({
+                    var item = new Ext.menu.CheckItem({
                         text: record.get("title"),
                         checked: record.get("layer").getVisibility(),
                         group: record.get("group"),
@@ -138,7 +138,12 @@
                                 record.get("layer").setVisibility(checked);
                             }
                         }
-                    }));
+                    });
+                    if (menu.items.getCount() > 2) {
+                        menu.insert(2, item);
+                    } else {
+                        menu.add(item);
+                    }
                 }
             });
         };



More information about the Commits mailing list