none
Display tooltip programmatically RRS feed

  • Question

  • I have created a group of pushpins using the following code (from a successful asynch JQuery get).

    I have created on the same page in a different div from the map, a list of these items.  When the user hovers over the anchor tag list I want the tooltip on the pushpin to change to displayed mode just as if the pushpin itself had been hovered over.

    I have tried several methods and none have worked.

    How is it done, please?

    val1 contains values "Name" and "TreatmentPlantId" along with "Point" which contains Latitude and Longitude

          $(resultTP.d).each(function (i, val1) {
                var wtpI = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(val1.Point.Latitude, val1.Point.Longitude), {
                    typeName: 'wtp' + val1.TreatmentPlantId,
                    icon: window.location.protocol + '//' + window.location.host + "/images/wtp.png"
                });
                my.vm.map().entities.push(wtpI);
                $('.wtp' + val1.TreatmentPlantId).children().attr('title', val1.Name);
            });



    • Edited by Jerry Lanp Thursday, April 4, 2013 2:10 AM
    Thursday, April 4, 2013 2:06 AM

Answers

  • Accessing the rendered HTML pushpin is unsupported and will cause issues. I suspect what's causing your issue is that the pushpin gets re-rendered from time to time which would remove any custom additions to the HTML of the pushpin. This usually occurs if the pushpin is out of view of the map (HTML of the pushpin is disposed). When the pushpin comes back into view then it is rendered. This is by design and makes a significant difference in performance.

    Your best supported option to do this is to tie into the mouse over event and to display a custom infobox that looks like a tooltip.


    http://rbrundritt.wordpress.com

    Thursday, April 11, 2013 5:21 PM