[Commits] r2212 - sandbox/camptocamp/extensions/geoext.ux/ux/FeatureBrowser/lib/GeoExt.ux

commits at geoext.org commits at geoext.org
Wed May 26 12:16:28 CEST 2010


Author: pgiraud
Date: 2010-05-26 12:16:28 +0200 (Wed, 26 May 2010)
New Revision: 2212

Modified:
   sandbox/camptocamp/extensions/geoext.ux/ux/FeatureBrowser/lib/GeoExt.ux/FeatureBrowser.js
Log:
better counter message management

Modified: sandbox/camptocamp/extensions/geoext.ux/ux/FeatureBrowser/lib/GeoExt.ux/FeatureBrowser.js
===================================================================
--- sandbox/camptocamp/extensions/geoext.ux/ux/FeatureBrowser/lib/GeoExt.ux/FeatureBrowser.js	2010-05-26 06:48:11 UTC (rev 2211)
+++ sandbox/camptocamp/extensions/geoext.ux/ux/FeatureBrowser/lib/GeoExt.ux/FeatureBrowser.js	2010-05-26 10:16:28 UTC (rev 2212)
@@ -22,8 +22,13 @@
 GeoExt.ux.FeatureBrowser = Ext.extend(Ext.Panel, {
 
     /* begin i18n */
-    /** api: config[featuresText] ``String`` i18n */
-    featuresText: "features",
+    /** api: config[counterText]
+     *  ``String`` i18n, The counter message to display (defaults to "{0} of
+     *  {1}). Note that this string is formatted using {0} as a token for index
+     *  and {1} as a token for total. These tokens should be preserved when
+     *  overriding this string if showing those values is desired.
+     */
+    counterText: "{0} of {1} features",
 
     /** api: config[elseTpl]
      *  ``Ext.Template`` | ``Ext.XTemplate`` Ext.Template or Ext.XTemplate
@@ -79,7 +84,7 @@
         var bbar = false;
         if (nbFeatures > 1) {
             bbar = [
-                nbFeatures + ' ' + this.featuresText,
+                {xtype: 'tbtext', id: 'counter-' + this.id},
                 '->',
                 {
                     id: 'move-prev' + this.id,
@@ -127,6 +132,9 @@
             'featureselected'
         );
         this.fireEvent('featureselected', this, this.features[0]);
+        Ext.getCmp('counter-' + this.id).setText(
+            String.format(this.counterText, 1, nbFeatures)
+        );
     },
 
     /** private: method[navHandler]
@@ -141,6 +149,9 @@
         this.fireEvent('featureselected', this, features[next]);
         Ext.getCmp('move-prev' + this.id).setDisabled(next===0);
         Ext.getCmp('move-next' + this.id).setDisabled(next==total - 1);
+        Ext.getCmp('counter-' + this.id).setText(
+            String.format(this.counterText, next + 1, total)
+        );
     },
 
     /** private: method[getTemplateForFeature]



More information about the Commits mailing list