Python Forum
Buttons in table. Which row was selected to export.
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Buttons in table. Which row was selected to export.
#2
I think you'll have to do something like:

{% for pdf_store in display_pdf_store %}
<tr onclick='highlight()'>
<form action='/download_pdf'>
<td> {{ pdf_store.product_serial_number}} <input type="hidden" name="product_serial_number" value="{{ pdf_store.product_serial_number}}" /> </td>
<td> {{ pdf_store.doctype}} <input type="hidden" name="doctype" value="{{ pdf_store.doctype}}" /> </td>
<td> {{ pdf_store.date_time}} <input type="hidden" name="date_time" value="{{ pdf_store.date_time}}" /> </td>
<td> {{ pdf_store.place_of_procedure}}  <input type="hidden" name="place_of_procedure" value="{{ pdf_store.place_of_procedure}}" /></td>
<td><input type='submit' id='Export' value='Export'></input></td>
</form>
</tr>
{% endfor %}
Or use JQuery to get the content of the row and pass it to the backend (AJAX?).
Just a start...

HTML:
{% for pdf_store in display_pdf_store %}
<tr onclick='highlight()'>
<td> {{ pdf_store.product_serial_number}}</td>
<td> {{ pdf_store.doctype}}</td>
<td> {{ pdf_store.date_time}}</td>
<td> {{ pdf_store.place_of_procedure}}</td>
<td><button type="button" value="export_pdf" class="export_pdf" /></td>
</tr>
{% endfor %}
JS:
$(".export_pdf").click(function() {
    var $tds = $(this).closest("tr").find("td");
    $.each($tds, function() {
        alert($(this).text());
    });
});
Reply


Messages In This Thread
RE: Buttons in table. Which row was selected to export. - by gontajones - Jul-05-2018, 11:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask export/upload database table in cvs/xlsx format steve87bg 4 7,062 Jun-19-2020, 01:46 PM
Last Post: steve87bg
  Want to scrape a table data and export it into CSV format tahir1990 9 5,537 Oct-22-2019, 08:03 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020