Reputation: 10646
I have a OpenLayers.Style like this :
PoisStyle = new OpenLayers.Style({
...
label: "${poiLabel}"
}, {
context: {
...
poiLabel: function(feature) {
return "+212011223344";
}
}
});
But the + in +212011223344
gets ignored, all that shows is 212011223344
.
Any ideas ?
Upvotes: 0
Views: 61
Reputation:
During evaluation the method OpenLayers.Style.createLiteral
is called, which contains this line:
value=(isNaN(value)||!value)?value:parseFloat(value);
The content of your string is classified as not being "not a number", therefore feed to parseFloat
which returns a number, and this number is converted to a string without a leading "+". Same way you would loose trailing zeros.
As quick fix you may insert a zero width nonbreak space into your literal:
return "+\ufeff212011223344";
This makes the string "not a number" w/o being visible.
Upvotes: 1