# Perspective Table sortOrder Property

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257>\
**Category:** Ignition Early Access\
**Created:** [July 1, 2020, 5:02pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257 "2020-07-01T17:02:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayce.oxton](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jayce.oxton](https://forum.inductiveautomation.com/u/jayce.oxton)\
**Post date:** [July 1, 2020, 5:02pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/1 "2020-07-01T17:02:47Z")

</div>

I couldn’t find any documentation on this. How do you use the sortOrder property on the Perspective Table? Can someone please provide me an example? I’ve trying to have the table load with one column as the primary column to sort on and then a second column to do a secondary sort of the rows. Is this what the sortOrder property is for?

---

<div class="post-metadata">

**Author:** ![JMicky](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@JMicky](https://forum.inductiveautomation.com/u/JMicky)\
**Post date:** [August 19, 2020, 6:03pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/2 "2020-08-19T18:03:34Z")

</div>

I am looking for an example also.

---

<div class="post-metadata">

**Author:** ![kyle.demerath](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kyle.demerath](https://forum.inductiveautomation.com/u/kyle.demerath)\
**Post date:** [October 9, 2020, 4:50pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/3 "2020-10-09T16:50:29Z")

</div>

same question…

---

<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 9, 2020, 5:12pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/4 "2020-10-09T17:12:13Z")

</div>

The sort order property should be an array of column names - the order they’re in will be the order they’re sorted by.

Each column config can have a `sort` key with a value of `ascending` or `descending` to control the sort direction.

At least, that’s how it should work based on scanning the code 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![nickbrickner](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@nickbrickner](https://forum.inductiveautomation.com/u/nickbrickner)\
**Post date:** [November 11, 2020, 7:52pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/5 "2020-11-11T19:52:26Z")

</div>

I succeeded in specifying the sort order by adding elements in the “sortOrder” property array, and for each element’s value, I specified the “field” id for each column object – in order of sort priority (e.g. “0:t\_stamp” for highest priority sorting on t\_stamp column of the table, “1:Comments” for 2nd highest priority sorting on Comments column, etc.). The sort direction is selected using the “sort” object-member of each column object within the “columns” table property. The “sort” object-member provides a drop down menu to select between “none”, “ascending”, and “descending”.

This method worked in the designer preview mode, but for some reason, it is not working when I launch the perspective session. Any ideas why this may be?

---

<div class="post-metadata">

**Author:** ![kyle.demerath](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kyle.demerath](https://forum.inductiveautomation.com/u/kyle.demerath)\
**Post date:** [February 8, 2021, 4:14pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/6 "2021-02-08T16:14:48Z")

</div>

I have been seeing this same issue - it seems to be a bug. It’s working in designer but not always when I launch a perspective session. For a while it seemed to work, then it wouldn’t. I’ve seen this on 8.1.1 and 8.1.2

---

<div class="post-metadata">

**Author:** ![OscarLucas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscarlucas/32/6417_2.png) [@OscarLucas](https://forum.inductiveautomation.com/u/OscarLucas)\
**Post date:** [March 10, 2021, 7:18am UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/7 "2021-03-10T07:18:38Z")

</div>

Where can we see an example?

---

<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:** [March 10, 2021, 3:56pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/8 "2021-03-10T15:56:48Z")

</div>

@nickbrickner, @kyle.demerath - there's currently a bug where the sort order is not properly applied if there's a binding on the data property _on first page load_ - navigating around (or setting the data property again) should make things work as long as the rest of the sorting configuration is set up appropriately.

> [@OscarLucas](#):
>
> Where can we see an example?

[table\_sort.zip](https://forum.inductiveautomation.com/uploads/short-url/kqxWM6xGKaRMmReLeWoBVSJ7nyT.zip) (4.6 KB)  
To properly sort a Perspective table, you need to have:

1. Objects defined in the `columns` array for each column in your dataset. Each of these objects has a `sort` property, which must be set to `ascending` or `descending` for automatic/initial load sorting to work.
2. `sortOrder` defined in `props`. Each key in this array should be the name of a particular column.

Note that in addition to the bug with first page load I noted above, there's a separate bug where numeric/date types are not properly sorted; they're sorted alphabetically instead of numerically. Both issues are in our backlog at a fairly high priority.

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [April 30, 2021, 1:26pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/9 "2021-04-30T13:26:07Z")

</div>

Hello) Can You explain me why sortOrder is sorting on first symbol ?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90239a00a4ba4b5ba7244bcb9930dc12b2c8caf9.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 30, 2021, 2:49pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/10 "2021-04-30T14:49:25Z")

</div>

It looks like you're using a version of Perspective where we had not locked down sorting. It's sorting that column in "descending" alphanumeric order. We recently resolved this issue (it can be found in the 8.1.6 nightly release) so that numeric columns sort as numbers instead of strings.

Update:  
It looks like it was fixed on the 22nd.

> **1993: Perspective Table Component - Allow sorting on the underlying array values**  
> Table component will now sort values based on the underlying data type passed to it instead of sorting alphanumerically due to string formatting.

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [April 30, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/11 "2021-04-30T14:54:56Z")

</div>

I solved as in there [[Bug-15644]Table sorting not working on numeric columns - #12 by rbachman](http://forum.inductiveautomation.com/t/bug-15644-table-sorting-not-working-on-numeric-columns/30245/12)

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [April 30, 2021, 2:55pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/12 "2021-04-30T14:55:35Z")

</div>

When we can have stable version 8.1.6?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 30, 2021, 3:53pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/13 "2021-04-30T15:53:18Z")

</div>

8.1.5 just released ~~this week~~ on Wednesday, so I would not expect 8.1.6 for nearly a month.

---

<div class="post-metadata">

**Author:** ![Andrii.Randiuk](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andrii.Randiuk](https://forum.inductiveautomation.com/u/Andrii.Randiuk)\
**Post date:** [May 2, 2021, 12:16pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/14 "2021-05-02T12:16:29Z")

</div>

thanks, but you said 8.1.6 will have this function…

---

<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:** [May 2, 2021, 1:04pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/15 "2021-05-02T13:04:01Z")

</div>

And it will. You can try it yourself in the nightly beta. Keep in mind that the branch between one release and the next happens at least a couple weeks before a release so IA’s QA department can run all their regression testing. Fixes and features that don’t make that cut-off show up in the following release. See this blog post for more info:

> **[All Aboard the Release Train. First Stop: Ignition 8!](https://www.inductiveautomation.com/blog/all-aboard-the-release-train-first-stop-ignition-8)**
>
> The first production release of Ignition 8 is just a few days away! In addition to all of the powerful new features included in Ignition 8, we’ve also made significant internal process changes to how we develop, test, and release Ignition. We wanted...

---

<div class="post-metadata">

**Author:** ![kyle.demerath](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kyle.demerath](https://forum.inductiveautomation.com/u/kyle.demerath)\
**Post date:** [June 10, 2021, 6:18pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/16 "2021-06-10T18:18:27Z")

</div>

Has the bug where the sorting does not work properly on the first load when there is a binding on the data been resolved? I am on 8.1.7 stable release and the issue still seems present. To be clear I have a table that a when the page first loads is going to be empty. After the user makes some selections elsewhere on the screen the data binding on the table will run again and then load data into the table. When this is happening, however, I do not see the “default” sorting working. If I simulate the screen with data already in the table, it does work, however.

---

<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:** [June 10, 2021, 6:20pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/17 "2021-06-10T18:20:52Z")

</div>

No, not yet. I just kicked the internal ticket a bit in priority.

---

<div class="post-metadata">

**Author:** ![kyle.demerath](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@kyle.demerath](https://forum.inductiveautomation.com/u/kyle.demerath)\
**Post date:** [January 7, 2022, 8:20pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/18 "2022-01-07T20:20:12Z")

</div>

So I thought I saw from a change log that this was fixed, but it doens’t seem to be fully resolved. In designer it is working for me, but not in the actual runtime (using Chrome).

---

<div class="post-metadata">

**Author:** ![reto.kunz](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@reto.kunz](https://forum.inductiveautomation.com/u/reto.kunz)\
**Post date:** [February 7, 2022, 10:59am UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/19 "2022-02-07T10:59:07Z")

</div>

Same problem here, the sort order still does not work on the initial page load.  
Would be really nice if you could prioritize this again.

---

<div class="post-metadata">

**Author:** ![Dustin\_Kwok](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@Dustin\_Kwok](https://forum.inductiveautomation.com/u/Dustin_Kwok)\
**Post date:** [June 22, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257/20 "2022-06-22T16:07:29Z")

</div>

> [@kyle.demerath](#):
>
> I am on 8.1.7 stable release and the issue still seems present. To be clear I have a table that a when the page first loads is going to be empty. After the user makes some selections elsewhere on the screen the data binding on the table will run again and then load data into the table. When this is happening, however, I do not see the “default” sorting working. If I simulate the screen with data already in the table, it does work, however.

Hi there, I've been trying to get the descending sortorder to work, but it doesnt seem to stick in Perspective. However, everything shows up correctly in the Designer. I have confirmed that sorting on first load works when there is no binding on the data property. Has a patch not come out for this bug yet?

[Next page](https://forum.inductiveautomation.com/t/perspective-table-sortorder-property/36257.md?page=2)
