[Users] custom text for ZoomSliderTip

Christian Mayer chris at meggsimum.de
Wed Feb 18 18:30:49 CET 2015


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


More information about the Users mailing list