In the example below, I'm creating href's for each row item in Column3 and the variable (var1) will be sent along with it (which works fine). My question is how can I also send the adjacent row value using a variable (var2) for Column1? Would this need to be handled with jquery or another means?
var2 below is what what I want to be able to do, but not sure how to, currently.
table:
Column1 Column2 Column3
Row1 Yes Foo Bar
Row2 No Foo1 Bar3
Row3 Maybe Foo2 Bar2
app.py:
@app.route('/mypage/<var1>')
def python_function(var1,var2):
df = pd.DataFrame(lotsofdata)
return render_template('index.html',data=df)
index.html:
<table id="data">
<thead>
<tr>
{% for c in data.columns.values %}
<th>{{ c }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for index, row in data.iterrows() %}
<tr>
{% for v in row %}
<td>
{% if data.columns[loop.index0] in ['Column3'] %}
<a href="{{ url_for('python_function',var1=v,var2=???) }}">{{ v }}</a>
{% else %}
{{ v }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>