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?
I am looking for an example also.
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
descending to control the sort direction.
At least, that’s how it should work based on scanning the code
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?
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
Where can we see an example?
@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.
table_sort.zip (4.6 KB)
To properly sort a Perspective table, you need to have:
- Objects defined in the
columnsarray for each column in your dataset. Each of these objects has a
sortproperty, which must be set to
descendingfor automatic/initial load sorting to work.
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.
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.
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.
I solved as in there [Bug-15644]Table sorting not working on numeric columns - #12 by rbachman
When we can have stable version 8.1.6?
8.1.5 just released
this week on Wednesday, so I would not expect 8.1.6 for nearly a month.
thanks, but you said 8.1.6 will have this function…
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: