[Commits] r2651 - sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets

commits at geoext.org commits at geoext.org
Thu Apr 14 16:04:31 CEST 2011


Author: adube
Date: 2011-04-14 16:04:31 +0200 (Thu, 14 Apr 2011)
New Revision: 2651

Modified:
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
Log:
WFSTFeatureEditing - mainPanelCt toggling

Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js	2011-04-14 13:19:46 UTC (rev 2650)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js	2011-04-14 14:04:31 UTC (rev 2651)
@@ -397,7 +397,8 @@
             "activate": function() {
                 this.layer.setVisibility(true);
 
-                this.manager.toggleMainPanelContainer(true);
+                this.manager.useFilter === false &&
+                    this.manager.toggleMainPanelContainer(true);
 
                 this.layer.wfstFeatureEditing.featureGrid.enable();
                 this.manager.featureGridContainer.setActiveTab(
@@ -583,6 +584,9 @@
             })
         });
 
+        // === events if using the 'userFilter' control ===
+
+        // return to selection if no features were returned
         this.useFilter && layer.events.on({"loadend": function(e) {
             if (!this.layer.wfstFeatureEditing.userFilterControl.hasBlankFilter
                 && this.grid.store.getCount() === 0) {
@@ -590,15 +594,24 @@
             }
         }, "scope": {"manager": this, "grid": featureGrid, "layer": layer}});
 
-        store.on("load", function(store, records, options) {
-            if (this.manager.useFilter &&
-                this.layer.wfstFeatureEditing.userFilterControl.active) {
-                if (store.getCount() === 1) {
+        // select first row if only one record (only if grid is rendered).
+        // Also display main panel ct.
+        this.useFilter && store.on("load", function(store, records, options) {
+            if (this.layer.wfstFeatureEditing.userFilterControl.active) {
+                store.getCount() === 1 && this.grid.rendered &&
                     this.grid.getSelectionModel().selectFirstRow();
-                }
+                store.getCount() >= 1 &&
+                    this.manager.toggleMainPanelContainer(true);
             }
         }, {"manager": this, "grid": featureGrid, "layer": layer});
 
+        // when the featureGrid is rendered, select the first row if there is
+        // only one
+        this.useFilter && featureGrid.on("render", function(grid) {
+            grid.store.getCount() === 1 &&
+                grid.getSelectionModel().selectFirstRow();
+        }, this);
+
         return featureGrid;
     },
 
@@ -618,6 +631,7 @@
         layer.wfstFeatureEditing.selectControl.unselectAll();
         layer.wfstFeatureEditing.highlightControl.deactivate();
         layer.wfstFeatureEditing.userFilterControl.activateHandlers();
+        this.toggleMainPanelContainer(false);
     },
 
     getNewFeatureStore: function(layer) {
@@ -696,12 +710,12 @@
     },
 
     toggleMainPanelContainer: function(display) {
-        if (display) {
-            this.mainPanelContainer.expand();
-            this.mainPanelContainer.show();
-        } else {
-            this.mainPanelContainer.expand();
-            this.mainPanelContainer.show();
+        var ct = this.mainPanel.ownerCt;
+        if (ct instanceof Ext.Window) {
+            display && ct.show();
+            !display && ct.hide();
+        } else if (ct.ownerCt && ct.ownerCt.layout === "accordion") {
+            ct.toggleCollapse(display);
         }
     }
 });



More information about the Commits mailing list