# \[IGN-6722\]Custom Sorting Algorithm's on Perspective Columns

**URL:** <https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [October 12, 2022, 5:54pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128 "2022-10-12T17:54:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 5:54pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/1 "2022-10-12T17:54:31Z")

</div>

Is there a way to add a custom sorting algorithm depending on which column is clicked on to sort? I'm having the usual problems of ascii and numbers, case sensitive and insensitive, a tale as old as time..

Thanks,

Jake

---

<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 12, 2022, 7:02pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/2 "2022-10-12T19:02:29Z")

</div>

No, it's not currently possible to customize the sorting logic; it's a 'natural' sort happening on the frontend.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 7:20pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/3 "2022-10-12T19:20:32Z")

</div>

Figured, I noticed a lot of people with hacks to get around it. Are there any plans to add this functionality in the future?Thx

---

<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 12, 2022, 7:24pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/4 "2022-10-12T19:24:47Z")

</div>

There may be plans, though I'm not sure how it would work, to be honest. Currently the sorting is quick because it's all happening on the frontend (in the browser). If we exposed it to scripting, it would require at least one round trip for all the data in your table, which is going to 'feel' a lot worse in terms of performance.

It's a hard problem, basically. But not one we're ignoring 🙂

One possible hack you could use in the short term:

1. Return the `value` key in your data as a value that cleanly sorts with the current implementation.
2. Add the actual value you want to display as an additional key.
3. Use subview rendering mode to display the 'actual value' key you added.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 7:30pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/5 "2022-10-12T19:30:37Z")

</div>

So I can have a key for sorting that's different than the value? How do I accomplish that?

Thanks,

---

<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 12, 2022, 7:34pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/6 "2022-10-12T19:34:36Z")

</div>

> [@codersmurf](#):
>
> How do I accomplish that?

> [@paul-griffith](#):
>
> Use subview rendering mode

Like that.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 7:35pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/7 "2022-10-12T19:35:09Z")

</div>

K, I'll research.Thx

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 7:39pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/8 "2022-10-12T19:39:20Z")

</div>

So the rows will have the data to sort on and then one would expand it to get the true data?

---

<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 12, 2022, 7:40pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/9 "2022-10-12T19:40:20Z")

</div>

No, it can be embedded directly, not a subview:  
[https://docs.inductiveautomation.com/display/DOC81/Table+Column+Configurations#TableColumnConfigurations-EmbeddingaViewinaTableCell](https://docs.inductiveautomation.com/display/DOC81/Table+Column+Configurations#TableColumnConfigurations-EmbeddingaViewinaTableCell)

---

<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 12, 2022, 7:40pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/10 "2022-10-12T19:40:28Z")

</div>

No, each column can be configured, if necessary, to display a subview instead of the normal column data. Right there in its place.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 8:34pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/11 "2022-10-12T20:34:23Z")

</div>

I gotcha, this seems like a decent workaround.Thx

---

<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 12, 2022, 8:48pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/12 "2022-10-12T20:48:59Z")

</div>

For what it's worth, I think the inverse of this idea (allowing you to specify which key in the value dictionary would be used as the sort value from the `columns` array) would be a pretty clean, pretty performant way to solve this problem. So I filed a ticket to see about implementing that.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [October 12, 2022, 8:50pm UTC](https://forum.inductiveautomation.com/t/ign-6722-custom-sorting-algorithms-on-perspective-columns/65128/13 "2022-10-12T20:50:02Z")

</div>

Agreed:)
