# Detect Which Table Column Was Clicked

**URL:** <https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [March 19, 2021, 1:56pm UTC](https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679 "2021-03-19T13:56:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.boog](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@m.boog](https://forum.inductiveautomation.com/u/m.boog)\
**Post date:** [March 19, 2021, 1:56pm UTC](https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679/1 "2021-03-19T13:56:07Z")

</div>

Morning All,

I’m working in Perspective, Gateway 8.0.16.

I’m trying to let a user click on a Table column heading to open up a custom filter popup. I’m able to add a filter icon via CSS, and can capture the mouse click via the Table’s OnClick event. What I’m unable to do is determine which column header was clicked. Is this possible?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [March 19, 2021, 8:23pm UTC](https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679/2 "2021-03-19T20:23:06Z")

</div>

Hi @m.boog, this can be found in table props: selection.selectedColumn

---

<div class="post-metadata">

**Author:** ![m.boog](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@m.boog](https://forum.inductiveautomation.com/u/m.boog)\
**Post date:** [March 19, 2021, 8:42pm UTC](https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679/3 "2021-03-19T20:42:54Z")

</div>

HI Matthew, thanks for the reply. I had started with this property, but found it lacking for my use case.

Given this table, I have a column heading (A) that I want the user to click on to open the popup. When the user click here, it triggers an onClick event and returns the last column selection **made in the table rows**. So if the user had selected the cell at (B), the onRowClick event would be triggered, and the selection.SelectedColumn would be set to ‘Container ID’. However, when the user clicks on (A) again, selection.SelectedColumn is still set to ‘Container ID’, and the onClick event has no information pertaining to the column I clicked on.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/8/e8585c687e59498cc7e5ef9aea4e6aa8e0a9a1cc.png)

The best solution I see at the moment is to create my own custom headings by rendering the top row of the table as a View, and handling the click event on the view. Not ideal, but it’ll get the job done.

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [March 20, 2021, 6:25am UTC](https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679/4 "2021-03-20T06:25:27Z")

</div>

Hi @m.boog, apologies I misunderstood what you were after.

I think your solution is the best way to go.

---

<div class="post-metadata">

**Author:** ![Nathan\_Willson1](https://avatars.discourse-cdn.com/v4/letter/n/dc4da7/32.png) [@Nathan\_Willson1](https://forum.inductiveautomation.com/u/Nathan_Willson1)\
**Post date:** [March 8, 2024, 1:27am UTC](https://forum.inductiveautomation.com/t/detect-which-table-column-was-clicked/44679/5 "2024-03-08T01:27:34Z")

</div>

Did your custom headers end up working? Were you able to maintain all table functionality such as column re-sizing?
