opengeo/gxp — Issue #104: when supportAbstractGeometry is true, the menu should show and hide
Author: bartvde
Created: 2011-11-29 22:46:39+00:00
State: open

but there does not seem to be a nice way in Ext to do that. You can use setDisabled, but this has the disadvantage that the menu still opens up. You can hide the individual items, but then the menu renders very ugly with a kind of pixel looking image. Ideally there would be a way to remove a menu from a button, but there seems no way currently in Ext. Removing the css class x-btn-arrow would actually work but is very low level and might break.

--- a/src/script/plugins/FeatureEditor.js
+++ b/src/script/plugins/FeatureEditor.js
@@ -712,7 +712,13 @@ gxp.plugins.FeatureEditor = Ext.extend(gxp.plugins.ClickableFeatures, {
var multi = (simpleType != mgr.geometryType);
this.setHandler(Handler, multi);
button.enable();
+ button.items[0].menu.items.each(function(item) {
+ item.hide();
+ });
} else if (this.supportAbstractGeometry === true && mgr.geometryType === 'Geometry') {
+ button.items[0].menu.items.each(function(item) {
+ item.show();
+ });
button.enable();
} else {
button.disable();