# Is there an event I can use in a change script for when a user sorts a table?

**URL:** <https://forum.inductiveautomation.com/t/is-there-an-event-i-can-use-in-a-change-script-for-when-a-user-sorts-a-table/80784>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [October 20, 2023, 7:06pm UTC](https://forum.inductiveautomation.com/t/is-there-an-event-i-can-use-in-a-change-script-for-when-a-user-sorts-a-table/80784 "2023-10-20T19:06:45Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [October 20, 2023, 7:35pm UTC](https://forum.inductiveautomation.com/t/is-there-an-event-i-can-use-in-a-change-script-for-when-a-user-sorts-a-table/80784/3 "2023-10-20T19:35:47Z")

</div>

I had originally asked the question in this thread:

> [@\[SOLVED\] Add alternating color to Perspective table rows through scripting after sorting the data](https://forum.inductiveautomation.com/t/solved-add-alternating-color-to-perspective-table-rows-through-scripting-after-sorting-the-data/73649):
>
> I have a generic Perspective table with an added custom property called ds that will call a named query in the future. On the table is a single system event onStartup that calls a custom method script on the table. [image] That custom method completes the following code: def colorRows(self): value = self.custom.ds # Initialize variables new\_list = [] is\_light = False # This variable will keep track of the current row color # Iterate over each dictionary in the original li…

but never got a clear answer on whether there was an event triggered by sorting a table.

I suppose what I am trying to do is style rows in a table **before CSS** sheets were introduced (v8.1.21).

I can do this using the striped color even / odd properties when there is a single color however when I want to color some rows red and others green based off data criteria that doesn't work anymore.

I think I can use the markdown component to inject html but I haven't convinced myself that is worth my time yet so I am looking for a quicker way to solve the problem 🙂

---

_[View the full topic](https://forum.inductiveautomation.com/t/is-there-an-event-i-can-use-in-a-change-script-for-when-a-user-sorts-a-table/80784)._
