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:
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.
No, not yet. I just kicked the internal ticket a bit in priority.