[Commits] r2152 - in core/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Thu Apr 29 16:51:36 CEST 2010


Author: pgiraud
Date: 2010-04-29 16:51:36 +0200 (Thu, 29 Apr 2010)
New Revision: 2152

Modified:
   core/trunk/geoext/lib/GeoExt/data/AttributeStore.js
   core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html
Log:
make sure that feature is up to date when AttributeStore initialized with both data and feature, r=elemoine, (Closes #254, at least). I'm so sorry for the noise

Modified: core/trunk/geoext/lib/GeoExt/data/AttributeStore.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/AttributeStore.js	2010-04-29 14:49:20 UTC (rev 2151)
+++ core/trunk/geoext/lib/GeoExt/data/AttributeStore.js	2010-04-29 14:51:36 UTC (rev 2152)
@@ -53,20 +53,24 @@
                 })
             );
             if(this.feature) {
-                this.bind(this.feature);
+                this.bind();
             }
         },
 
         /** private: method[bind]
-         *  :param feature: ``OpenLayers.Feature.Vector``
          */
-        bind: function(feature) {
+        bind: function() {
             this.on({
                 "update": this.onUpdate,
                 "load": this.onLoad,
                 "add": this.onAdd,
                 scope: this
             });
+            var records = [];
+            this.each(function(record) {
+                records.push(record);
+            });
+            this.updateFeature(records);
         },
 
         /** private: method[onUpdate]

Modified: core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html	2010-04-29 14:49:20 UTC (rev 2151)
+++ core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html	2010-04-29 14:51:36 UTC (rev 2152)
@@ -39,7 +39,7 @@
     }
 
     function test_feature(t) {
-        t.plan(34);
+        t.plan(35);
 
         // set up
 
@@ -188,6 +188,15 @@
         t.eq(feature.attributes.foo6, "bar6",
              "feature attribute foo6 added, with correct value");
 
+        // create an AttributeStore with data and a feature
+        store = new GeoExt.data.AttributeStore({
+            feature: feature,
+            data: data
+        });
+
+        t.eq(feature.attributes.foo1, "bar1",
+             "feature attribute foo1 added, with correct value");
+
         // tear down
     }
 



More information about the Commits mailing list