Here is a example of the scale combo factory which provides a function that helps building scales combos. They behaves like classical combos. The main difference is that users give a set of scales. Those scales are formated in a way they are human readable and localized in a next step.
var combo = GeoExt.widgets.createScaleComboBox(
{scales: [2500,5000,10000,25000,50000]},
{
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,
emptyText: 'Choose a scale',
applyTo: "combo1"
}
);
In this example, the map is zoom to scale when a value is chosen in the scale combobox.
var combo = GeoExt.widgets.createScaleComboBox(
{scales: [500000, 10000000, 25000000, 50000000, 100000000]},
{
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus:true,
emptyText: 'Choose a scale',
applyTo: "combo2",
listeners: {
select: function(combo, record, index) {
map.zoomToScale(record.data.value);
}
}
}
);