Thank for the very kind help... but it is so tricky.......
Now i try the following without success:
----------------------
function initialize() {
if (GBrowserIsCompatible()) {
var i = 0;
//Icon Definition
var cicon = new GIcon();
cicon.iconSize=new GSize(22,22);
cicon.iconAnchor=new GPoint(11,11);
cicon.infoWindowAnchor=new GPoint(11,11);
// Icon Array
var gicons = [];
gicons["grosso"] = new GIcon(cicon, "fileadmin/schmitz/template/
images/grosso.png");
gicons["fach"] = new GIcon(cicon, "fileadmin/schmitz/template/
images/fach.png");
gicons["blau"] = new GIcon(cicon, "fileadmin/schmitz/template/
images/blau.png");
// Start: Funktion zum erstellen des Markers und Eventwindows
function createMarker(point,name,icon,infotabs) {
// Erstellen des Markers mit dem entsprechenden Icon
var marker = new GMarker(point, gicons[icon]);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(infotabs);
})
return marker;
}
// Ende: Funktion zum erstelln des Markers und Eventwindows
// Start: Erstellen der Karte
var map = new GMap2(document.getElementById("kd_map"));
// Festlegen des Center-Punktes
map.setCenter(new GLatLng(51.50167,7.091954), 9);
// Kartennavigation
map.addControl(new GLargeMapControl());
//Kartentypen
map.addControl(new GMapTypeControl());
// Suchfeld unten rechts
//map.addControl(new google.maps.LocalSearch(), new
GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
}
// Ende: Erstellen der Karte
// Start: Auslesen der Daten aus der Datei data.xml
GDownloadUrl("fileadmin/schmitz/template/marker/data.xml",
function(data, responseCode) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++)
{
var point = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var label = markers[i].getAttribute("kdname");
// Auslesen der Icontype-Information
var icon = markers[i].getAttribute("icon");
var tab1 = "fileadmin/schmitz/template/marker/";
tab1 += markers[i].getAttribute("tab1");
var tab2 = "fileadmin/schmitz/template/marker/";
tab2 += markers[i].getAttribute("tab2");
var content1;
var content2;
GDownloadUrl(tab1, function(html,responseCode) {
content1 = html;
}); // end of callback
GDownloadUrl(tab2, function(html,responseCode) {
content2 = html;
}); // end of callback
var infoTabs = [
new GInfoWindowTab("Übersicht", content1),
new GInfoWindowTab("Öffnungszeiten", content2)
];
//Erzeugen des Markers mit Icontype als Bild
var marker = createMarker(point,label,icon,infoTabs);
map.addOverlay(marker);
}
});
------------------------------------------------
Any ideas ?
On 20 Jul., 18:09, Rossko <[email protected]> wrote:
> > Therefore it is not possible to call a html Site in an Tab but in an
> > infowindow it works ?
>
> It's possible,but you need to do things in the right order.
>
> GDownloadUrl is asynchronous
> http://econym.org.uk/gmap/async.htm
>
> Looking at your code
> GEvent.addListener(marker, "click", function() {
> GDownloadUrl(tab1, function(html,responseCode) {
> content1 = html;}
> .....
> marker.openInfoWindowTabsHtml([new GInfoWindowTab(...
>
> An anonymous function is defined to be executed on marker click, so
> far so good.
> When clicked and executed, GDownloadUrl() is called. This fires off a
> request for the data - that's all. The data will take ages to come
> back, in javascript terms.
> Meantime the code doesn't stop, it carries on.
> Eventually it gets to the openInfoWindowTabsHtml(), but the data still
> isn't available so broken tabs are created.
> Ages later, the data appears at the browser, the download callback is
> executed, and the variable 'content1' is set.
> Nothing else happens with 'content1', because the open infowindow
> business finished (badly) long ago.
>
> You can only use asynchronous data after it is available. You don't
> know when it will be available, so you have to use the 'callback'
> function which is automatically run when the data really is available.
>
> Skeleton code
> GEvent.addListener(marker, "click", function() {
> GDownloadUrl(tab1, function(html,responseCode) {
> content1 = html;
> marker.openInfoWindowTabsHtml( use content
> here)
> } // end of callback
> } //end of click listener
>
> The difficulty that you will face is that you need to get multiple
> asynchronous calls to assemble _all_ your data, before opening the
> infowindow.
>
> An alternative approach that might work better is to open your tabbed
> infowindow at the click, but populate it with some dummy data. Fire
> off your GDownloadUrls and set each ones callback up to update the
> dummy data in the existing tabs into the real data, as it becomes
> available.
>
> This stuff isn't easy.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.