Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

295
Views
Variables en javascript + jinja2

No soy bueno en javascript. Tengo gráficos de Google con datos. Y necesito agregar datos a través de bucle en javascript:

 for (let i = 0; i < 3; i++) { data.addRow( ['{{list[i][0]}}', { v: {{list[i][1][0]}}, f: '{{list[i][1][1]}}' }] ); }

Pero me escribió un error:

 UndefinedError

jinja2.exceptions.UndefinedError: el objeto de la lista no tiene ningún elemento Indefinido

¿Me puede aconsejar por favor, lo que puedo hacer con él?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

No estoy muy familiarizado con la API de Google Charts, pero por lo que parece, tiene un error de sintaxis ya que literalmente está pasando la cadena '{{list[i][0]}}' a data.addrow() método.

Prueba esto en su lugar y hazme saber si funciona:

 for (let i = 0; i < 3; i++) { data.addRow([ list[i][0], { v: list[i][1][0], f: list[i][1][1] } ]); }
about 4 years ago · Juan Pablo Isaza Report

0

He encontrado la respuesta. Prueba así:

 {% for i in range(list|length) %} data.addRow( ['{{list[i][0]}}', { v: {{list[i][1][0]}}, f: '{{list[i][1][1]}}' }] ); {% endfor %}

No es javascript, lo sé. Pero me ayudó a resolver el problema.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!