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

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

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

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

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 :slight_smile:

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.
2 Likes

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

Thanks,

Like that.

K, I'll research.Thx

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

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

1 Like

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

I gotcha, this seems like a decent workaround.Thx

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.

2 Likes

Agreed:)