I may not be a professional web developer, but I am venturing into creating a simple web app using Django due to my familiarity with Python. My knowledge of JavaScript is limited to the basics.
Currently, my main page features a table on the left side generated by the django-tables2 library and a graph on the right created using the chart.js library. I have successfully set up the structure for both components.
However, I am facing a roadblock in figuring out how to implement click events on the rows within my table. Ideally, I would like the graph to update each time a row in the table is clicked. Most resources I've come across suggest using table IDs for this purpose, but since I'm utilizing django-tables2, I haven't explicitly defined a table ID. The code primarily responsible for generating the table is as follows:
{% load render_table from django_tables2 %}
{% render_table table %}
The view associated with this table looks something like:
class RaceListView(SingleTableView):
model = Race
table_class = RaceTable
template_name = 'prediction.html'
If more information or specific code snippets are needed to assist me better, please feel free to request them as Django tends to intricately link various parts together.
If anyone can provide a straightforward example of incorporating click events into tables like mine, I'd greatly appreciate it. Thank you!