You mentioned that the underlying view design had the columns categorised, which is right. Is this just a flat view? Is the column you’re sorting on just text?
I have a column in a view called ‘TakenBy’ I want this to be sortable, both ways. This column in the underlying view is Sorted, not categorised - does it need to be categorised too?
Yes, its just a flat view and the column value is just text. I have the first column sorted which is used as a key (have a drop down for site which is linked to the sorted first column) - Can you not have more than one column sortable?!?
Is your drop-down for Site sorting the DominoView data? That might override the subsequent attempt to sort at column level. Or is some code on the load of the page overriding the sort?
What do you have for the xp:dominoView element? If you have a sortColumn or categoryFilter defined there, it might be worth trying without it.
It looks like the problem is the keys. I’ve just tested that on my view, and it prevents the sort. I have a search function for the view as well, and when the search is included, I cannot sort the columns (see code below). I guess the view settings are overriding the sort request from the column. I haven’t been able to get sortColumn and sortOrder to work (last time I looked I couldn’t find any documentation on what allowed values should be), but that might allow you to set the sorting based on a scoped variable. This could work because the sort is on the same element as the keys, the DominoView element. You would need to set the scoped variable from a button rather than the column heading.
It looks like it’s a known issue and a tricky one to fix. Just a thought, depending on the size of the view and the amount of sorted columns you want, how about using a repeat control to show the entries for the relevant Site category, using a view where the second column is sorted on TakenBy. Because the repeat control is using a notesViewEntryCollection, the order should be retained. To sort on a different column, you would have to use a different view sorted on that column.
There are probably other options based around getting the relevant documents / note IDs / UNIDs through script and returnito a repeat control.