Hello !
i use a infobox for defined points
var infobox = new com.ptvag.webcomponent.map.vector.InfoBox();
infobox.set({x:4303250,y:5486500,text:"Mc Donalds"});
vectorLayer.addElement(infobox);
is it possible to edit this Text on the map ?
Regards
Andreas
ajax maps infobox - editing possible ?
-
- Posts: 13
- Joined: Tue May 13, 2014 3:28 pm
Re: ajax maps infobox - editing possible ?
Hi Andreas,
the text in an InfoBox is HTML, so you can put anything there. Here's a small example that makes the text editable (not pretty and only tested in Chrome, but you should get the idea):
Regards,
Andreas (yes, me too )
the text in an InfoBox is HTML, so you can put anything there. Here's a small example that makes the text editable (not pretty and only tested in Chrome, but you should get the idea):
Code: Select all
var infobox = new com.ptvag.webcomponent.map.vector.InfoBox();
var myText = "Test";
function setContents() {
var textSpan = document.createElement("span");
textSpan.id = "textSpan";
textSpan.appendChild(document.createTextNode(myText));
infobox.setText(textSpan.outerHTML);
setTimeout(function() {
textSpan = document.getElementById("textSpan");
textSpan.onclick = textClicked;
}, 0);
}
function textClicked() {
var input = document.createElement("input");
input.id = "textInput";
infobox.setText(input.outerHTML);
setTimeout(function() {
input = document.getElementById("textInput");
input.value = myText;
input.onkeydown = textKeyDown;
input.focus();
}, 0);
};
function textKeyDown(e) {
if (!e) e = window.event;
if (e.keyCode == 13) {
if (this.value.trim() != "") {
myText = this.value;
}
setContents();
}
};
infobox.set({x:4303250,y:5486500});
setContents();
vectorLayer.addElement(infobox);
Andreas (yes, me too )
Re: ajax maps infobox - editing possible ?
Thank you very much / Danke 1000 fach !
it runs!!!
Regards /Grüße aus Wien
Andreas Nemec
it runs!!!
Regards /Grüße aus Wien
Andreas Nemec