Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

328
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda