How to select desired table column?

Hi,

I’m developing a website using Django. I would like to select a desired columns from a table using the PC mouse. Could you please advise how to do that? Something smart like selecting the whole column by clicking the column header or using checkboxes over the column headers? Is there any tutorial about that?

Thank you!

Could you please provide more context. I assume you want to select a table in a Django HTML template? But what do you want to do with the column after selecting it?

I want to select table columns in a Django html template. Then I will calculate a Pearson correlations using this link:

I will visalize the result using various graphical representations.

You have two different parts to this.

The first would be the JavaScript in the browser - something that identifies what has been clicked, sets some kind of internal state to track that, and then provides the visual indicator on the page.

Then, either from that click or some other action (like a “Calculate” button), the JavaScript would submit that selection to a Django view that you will have written to perform those calculations, and return the results to the browser.

Your JavaScript receives that response and updates the page accordingly.

(Or, it could also be that the action button causes a full page reload such that your view returns a complete page and not just a set of updates to the page.)

You can avoid the JavaScript by using checkboxes with the column headers and having your action button submit those checkboxes as a form, which would result in a full page reload.

1 Like