# Power Table Sort Script

**URL:** <https://forum.inductiveautomation.com/t/power-table-sort-script/15524>\
**Category:** Ignition\
**Created:** [September 30, 2017, 7:51pm UTC](https://forum.inductiveautomation.com/t/power-table-sort-script/15524 "2017-09-30T19:51:53Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Kleppe85](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kleppe85](https://forum.inductiveautomation.com/u/Kleppe85)\
**Post date:** [November 9, 2017, 10:44pm UTC](https://forum.inductiveautomation.com/t/power-table-sort-script/15524/3 "2017-11-09T22:44:56Z")

</div>

Spent some time on this today and figured out another way to sort the Power table.  
Currently running this script on Power Table “init” extension function.

```
from javax.swing import SortOrder
from javax.swing import RowSorter

sortList = []
sortList.append(RowSorter.SortKey(0, SortOrder.DESCENDING)) #0 equals the column number, SortOrder either "ASCENDING" or "DESCENDING".
table = self
gTable = table.getTable()
gTable.setAutoCreateRowSorter(True)
gTable.getRowSorter().setSortKeys(sortList)
gTable.setAutoCreateRowSorter(False)
```

---

_[View the full topic](https://forum.inductiveautomation.com/t/power-table-sort-script/15524)._
