Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

329
Vistas
Display popup information beside map in a table when I click a marker with leaflet/django

I am using Leaflet JS and Django to create a map website. I have markers on the map showing correctly and I'm trying to display a table in a seperate div beside the map displaying information that would be in the popup.

I am also using a Django REST api to store marker data such as lat & long, names etc. My api returns this:

[
    {
        "id": 2,
        "cube": "Industrial Cube North",
        "cubeurl": "https://dcwppntise010.edc.nam.gm.com/admin/login.jsp",
        "hostname": "acrptisepsn01",
        "domain": "nam",
        "personas": "Policy Service",
        "ip": "10.36.139.120",
        "structurename": "Rochester COMP",
        "streetaddress": "1000 Lexington Ave",
        "latitude": 43.18226,
        "longitude": -77.65599
    },

I fetch data from my API like:

            {% for item in data %}
            var marker = L.marker([{{item.latitude}},{{item.longitude}}]).bindPopup("<strong>{{item.hostname}}</strong><br/>{{item.personas}}").addTo(map).on('popupopen', function (e) {
                    console.log(e.popup.getContent())
            });;
            {% endfor %}

It logs the content in the console but don't know how to dynamically change info in the table for each marker (they have different info & locations)

I have seen examples such as: http://www.gistechsolutions.com/leaflet/DEMO/baseball/BaseballPanel.html

That uses GeoJson and I'm not sure how to apply the same logic to my setup.

Thank you!

EDIT - I've looked into on click functions in Javascript to capture the popup info in variables and return it but I get undefined as the result, leading me to think you can't do that with Django

I need a table like this: enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda