1👍
You can use a data attribute which lets you store information on an element.
<button name="delete-button" id="" data-id={{record.id}} type="button">Delete order</button>
You can then pull the value from the data attribute in your click handler.
function onClick (event) { var id = event.target.dataset.id; }
0👍
You could use:
delete = tables.TemplateColumn('<button name="delete-button"
id="delete-button-{{record.id}}" value={{record.id}} type="button">Delete order</button>')
That way each button will have it’s own id ej: delete-button-1 and will have a reference to the id of the record.
- Real-Time Database Messaging
- Django – Saving formset data with different values
- Proxy my Elastic Search connection through Django for filtering
Source:stackexchange.com