# Send message when table header is clicked

**URL:** <https://forum.inductiveautomation.com/t/send-message-when-table-header-is-clicked/82554>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 30, 2023, 7:43pm UTC](https://forum.inductiveautomation.com/t/send-message-when-table-header-is-clicked/82554 "2023-11-30T19:43:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gavin\_Tipker](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@Gavin\_Tipker](https://forum.inductiveautomation.com/u/Gavin_Tipker)\
**Post date:** [November 30, 2023, 7:43pm UTC](https://forum.inductiveautomation.com/t/send-message-when-table-header-is-clicked/82554/1 "2023-11-30T19:43:53Z")

</div>

So I have a table that shows users order information. Depending on what department they are in they might have thousands of orders open at one time which really slows down the tables function. I have filters that can be applied to the data and was handling that on the front end but it was very slow with large sets of data. I've since changed the way those filters work to where they run on the database and deliver the information prefiltered to the users. I also only send them 100 rows at a time and set up custom pagination to pull the next 100 rows from the database when they click the next page. This is all working great but one of my users brought up a good point about sorting that I didn't think about. When they use the built in sort function on the tables headers it only sorts the 100 rows loaded in. I'm looking to send a message to the page when someone clicks the column header so I know they want to filter that column and then have the database handle that like I do with the filters but I don't know how to send a message when they click the table headers.

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 30, 2023, 7:53pm UTC](https://forum.inductiveautomation.com/t/send-message-when-table-header-is-clicked/82554/2 "2023-11-30T19:53:59Z")

</div>

Setting `virtualized : true` and either `pager.top : true` or `pager.bottom : true` should give your desired functionality automatically.

i.e., Let the query return all the data but let the Ignition gateway sort out the filtering, pagination and sorting of the data.

[https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Table#PerspectiveTable-Properties](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Table#PerspectiveTable-Properties)

---

<div class="post-metadata">

**Author:** ![Gavin\_Tipker](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@Gavin\_Tipker](https://forum.inductiveautomation.com/u/Gavin_Tipker)\
**Post date:** [November 30, 2023, 8:10pm UTC](https://forum.inductiveautomation.com/t/send-message-when-table-header-is-clicked/82554/3 "2023-11-30T20:10:51Z")

</div>

Well the problem with that is I'm using some javascript to allow drag and drop from one table to another. This has to pull a row out of an array of 7,000 records and put it in to another array and shuffle them around so it shows in the section of the table it was dragged to since I allow the users to custom order their tables. This slows things down when all of the records are loaded at once. That is why I moved to pushing the filtering to the DB.
