# Vision Power Table Runtime Sort and Filter Jython Get & Set

**URL:** <https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398>\
**Category:** Ignition\
**Tags:** scripting, vision, ignition81\
**Created:** [October 8, 2026, 6:11pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398 "2026-10-08T18:11:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Drew\_Hitchcock](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Drew\_Hitchcock](https://forum.inductiveautomation.com/u/Drew_Hitchcock)\
**Post date:** [October 8, 2026, 6:11pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/1 "2026-10-08T18:11:11Z")

</div>

I have a few Vision Power Tables in an application. The client asked if I could make sorts and filters applied during runtime persist when they navigate away from the screen and return. Could implement this with a change script on the viewDataset property that writes the current sort and filter to client tags and use the initialize extension function to load the sort and filter. However, I am not sure how to get and set the currently applied runtime sort and filter information with Python/Jython. Can anyone give me some sample code for this? Thanks.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 8, 2026, 6:50pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/2 "2026-10-08T18:50:52Z")

</div>

Simplest possible solution first: if you set the window's cache policy to Always, does it persist your runtime settings within the live client?

> **[Properties​ - Vision - The Window Object | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.3/appendix/components/vision-components/vision-window-object#properties)**
>
> See the Vision - The Window Object Scripting Functions page for the full list of scripting functions available for this component. | Windows are the top-level unit of design for Vision projects.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 8, 2026, 6:51pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/3 "2026-10-08T18:51:26Z")

</div>

I haven't seen anyone do this, but it should be possible. You'll have to dig into the sparse documentation of the JideTable:

> **[JIDE Software - JIDE Grids - Advanced Swing Table, SortableTable,...](https://www.jidesoft.com/products/grids.htm)**

Please share your solution....

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 8, 2026, 7:08pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/4 "2026-10-08T19:08:17Z")

</div>

Some possible prior art:

> [@Power Table Sort Script](https://forum.inductiveautomation.com/t/power-table-sort-script/15524/3):
>
> 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…

---

<div class="post-metadata">

**Author:** ![Drew\_Hitchcock](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Drew\_Hitchcock](https://forum.inductiveautomation.com/u/Drew_Hitchcock)\
**Post date:** [October 9, 2026, 4:34pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/5 "2026-10-09T16:34:51Z")

</div>

Window cache policy works great for making filters persistent but doesn't appear to work for sorts, even if I remove binding on table data. Linked forum post did not appear to provide a way to extract currently applied sort order, although it looks like it would work to set sort order. Filters was probably the more important of the two to the client. Don't know if I have the time or inclination to go down that particular Jython rabbit trail, but if someone knows the answer, I'd be curious. Thanks for the info.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 10, 2026, 10:48am UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/6 "2026-10-10T10:48:06Z")

</div>

In the power table, you can get the column sort information directly from the table model in this way on the propertyChange event handler:

```python
if event.propertyName == 'viewDataset':
	table = event.source.table
	model = table.model
	sortingColumns = model.sortingColumns
	
	if sortingColumns:
		sortedColumn = sortingColumns[0].column
		isAscending = sortingColumns[0].ascending
	else:
		sortedColumn = None
		isAscending = None
	
	# Store this integer and bool somewhere... client tag?
	print sortedColumn, isAscending

```

I'm not sure which event you would want to use to put the sort back. Perhaps the window's `internalFrameActivated`?

...but it would go back like this:

```python
sortedColumn, isAscending = # get this stuff from whereever it's stored

if sortedColumn is not None:
	# Correct path to table as needed, and apply the sort
	table = event.source.rootContainer.getComponent('Power Table').table
	table.model.sortColumn(sortedColumn, True, isAscending)

```

**Edit:** added None type check to the apply sort script

---

<div class="post-metadata">

**Author:** ![Drew\_Hitchcock](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Drew\_Hitchcock](https://forum.inductiveautomation.com/u/Drew_Hitchcock)\
**Post date:** [October 12, 2026, 12:19pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-runtime-sort-and-filter-jython-get-set/117398/7 "2026-10-12T12:19:39Z")

</div>

Works great. Using table initialize event to apply sort. Thanks.
