[Users] custom text for ZoomSliderTip

Moen Endre endre.moen at imr.no
Fri Feb 20 09:22:37 CET 2015


Thanks Chris! That works. I extended the data object that was already in getText with 
  region: zoomSliderRegionLookup[thumb.value]

Cheers
Endre

-----Original Message-----
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf Of Christian Mayer
Sent: 18. februar 2015 18:31
To: users at geoext.org
Subject: Re: [Users] custom text for ZoomSliderTip

Hi Endre,

at the moment there is no out-of-the-box solution for this neither in GeoExt 1.x nor in GeoExt 2.x. According to your sample code I guess that you use GeoExt 1.x ?

You can achieve this by defining a lookup object mapping e. g. the zoom level to a text:

var lookup = {
    0: "International" ,
    1: "National",
    // ...
}

and read the text defined by the zoom level and pass it via the 'getText' function of the slider's tip , like this (untested):

...

     plugins: new Ext.slider.Tip({
         getText: function(thumb){
             return String.format('{0}', lookup[thumb.value]);
         }
     })

...

Hope this helps as a kind of kickstart.

Cheers,
Chris

Am 17.02.2015 um 15:46 schrieb Moen Endre:
> I have a definition of a zoomslider like this:
> xtype: "gx_zoomslider",
>                 vertical: true,
>                 height: 100,
>                 plugins: new GeoExt.ZoomSliderTip({
>                     template: "<div>Zoom level: {zoom}</div><div>resolution:{resolution}</div>"
>                 }
> 
> But I would like to substitute {resolution} with the text International, National, Regional, Local - depending on which zoom level the user have zoomed at. But the only variables that can be used is {scale}, {resolution} and {zoom}. How is the best way of adding these new text strings? E.g. I would like International to be associated with zoom level 0,1, and 2.
> 
> Thanks
> Endre
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> 

--
Christian Mayer, Dipl.-Ing.(FH)
GIS-Spezialist & Software-Developer
Web: http://www.meggsimum.de
Mail: chris at meggsimum.de
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users


More information about the Users mailing list