title: Flask jinja2 table generation with variable
body: <p>I'd like to filter dynamically a flask generated table thanks to a variable set in JavaScript from another similar table.</p>
  
  <p>Unfortunately, it seems that Javascript variables cannot be reused in Jinja2 contexts (because jinja2 contexts are run prior to Javascript).</p>
  
  <p>In the example below, I'd like to filter the tasks with the project_id. This project_id was set thanks to the value selected in another table.</p>
  
  <p>Note: I'd like to avoid to reload the page thanks to this solution.</p>
  
  <pre><code>    {% for Task in mytasks %}
      {% if Task.project_id == var_project_id %} &lt;- Not working, the javascript variable is not recognized 
          &lt;tr class="clickable-row"&gt;
          &lt;td style="display:none;"&gt; {{ Task.task_id }} &lt;/td&gt;
          &lt;td style="display:none;"&gt; {{ Task.project_id }} &lt;/td&gt;
          &lt;td&gt;{{ Task.title }}&lt;/td&gt;
          &lt;td class="task_description" &gt; {{ Task.description }} &lt;/td&gt;
          &lt;td class="task_creation_date"&gt; {{ Task.creation_date }} &lt;/td&gt;
          &lt;/tr&gt;
    {% endfor %}
  </code></pre>